Regexp::Pattern::DefHash3pm
Regexp patterns related to defhash
Usage
use Regexp::Pattern; # exports re()my $re = re("DefHash::attr");
Version
This document describes version 0.001 of Regexp::Pattern::DefHash (from Perl distribution Regexp-Pattern-DefHash), released on 2021-07-22.
Overview
Regexp::Pattern is a convention for organizing reusable regex patterns.
Regexp patterns
- •
-
attr
Tags: anchored, capturing
Attribute key.
Examples:
Example #1.
".attr" =~ re("DefHash::attr"); # matchesExample #2.
"._attr" =~ re("DefHash::attr"); # matchesExample #3.
".attr1.subattr2" =~ re("DefHash::attr"); # matchesExample #4.
"prop.attr1" =~ re("DefHash::attr"); # matchesExample #5.
"_prop._attr1" =~ re("DefHash::attr"); # matchesExample #6.
"Prop.attr1.subattr2.Subattr3" =~ re("DefHash::attr"); # matchesExample #7.
"_prop.attr1" =~ re("DefHash::attr"); # matchesCannot start with digit (1).
".0attr" =~ re("DefHash::attr"); # DOESN'T MATCHCannot start with digit (2).
"prop.0attr" =~ re("DefHash::attr"); # DOESN'T MATCHCannot start with digit (3).
"prop.attr.0subattr" =~ re("DefHash::attr"); # DOESN'T MATCHInvalid character: dash (1).
".attr-ibute" =~ re("DefHash::attr"); # DOESN'T MATCHInvalid character: dash (2).
"prop-erty.attribute" =~ re("DefHash::attr"); # DOESN'T MATCHInvalid character: dash (3).
"prop.attr-ibute" =~ re("DefHash::attr"); # DOESN'T MATCHInvalid character: whitespace (1).
"property .attr" =~ re("DefHash::attr"); # DOESN'T MATCHInvalid character: whitespace (2).
"property.attr " =~ re("DefHash::attr"); # DOESN'T MATCHInvalid character: whitespace (3).
".attr " =~ re("DefHash::attr"); # DOESN'T MATCHInvalid syntax: dot only.
"." =~ re("DefHash::attr"); # DOESN'T MATCHInvalid syntax: double dot.
"..attr" =~ re("DefHash::attr"); # DOESN'T MATCHInvalid syntax: dot without attr.
"attr." =~ re("DefHash::attr"); # DOESN'T MATCHInvalid syntax: dot without attr (2).
"attr.." =~ re("DefHash::attr"); # DOESN'T MATCHEmpty.
"" =~ re("DefHash::attr"); # DOESN'T MATCHProperty, not attribute.
"p" =~ re("DefHash::attr"); # DOESN'T MATCHProperty, not attribute.
"_" =~ re("DefHash::attr"); # DOESN'T MATCH
- •
-
attr_part
Tags: anchored
Attribute part in attribute key.
Examples:
Empty.
"" =~ re("DefHash::attr_part"); # DOESN'T MATCHExample #2.
"p" =~ re("DefHash::attr_part"); # matchesExample #3.
"p.q" =~ re("DefHash::attr_part"); # matchesDot prefix must not be included.
".p" =~ re("DefHash::attr_part"); # DOESN'T MATCH
- •
-
key
Tags: anchored, capturing
Attribute key or property key.
All keys in defhash must match this pattern.
Examples:
Example #1.
"p" =~ re("DefHash::key"); # matchesExample #2.
"_" =~ re("DefHash::key"); # matchesExample #3.
"prop" =~ re("DefHash::key"); # matchesExample #4.
"Prop2" =~ re("DefHash::key"); # matchesExample #5.
"prop_" =~ re("DefHash::key"); # matchesCannot start with digit.
"0prop" =~ re("DefHash::key"); # DOESN'T MATCHInvalid character: dash.
"prop-erty" =~ re("DefHash::key"); # DOESN'T MATCHInvalid character: whitespace.
"property " =~ re("DefHash::key"); # DOESN'T MATCHExample #9.
".attr" =~ re("DefHash::key"); # matchesExample #10.
"._attr" =~ re("DefHash::key"); # matchesExample #11.
".attr1.subattr2" =~ re("DefHash::key"); # matchesExample #12.
"prop.attr1" =~ re("DefHash::key"); # matchesExample #13.
"_prop._attr1" =~ re("DefHash::key"); # matchesExample #14.
"Prop.attr1.subattr2.Subattr3" =~ re("DefHash::key"); # matchesExample #15.
"_prop.attr1" =~ re("DefHash::key"); # matchesCannot start with digit (1).
".0attr" =~ re("DefHash::key"); # DOESN'T MATCHCannot start with digit (2).
"prop.0attr" =~ re("DefHash::key"); # DOESN'T MATCHCannot start with digit (3).
"prop.attr.0subattr" =~ re("DefHash::key"); # DOESN'T MATCHInvalid character: dash (1).
".attr-ibute" =~ re("DefHash::key"); # DOESN'T MATCHInvalid character: dash (2).
"prop-erty.attribute" =~ re("DefHash::key"); # DOESN'T MATCHInvalid character: dash (3).
"prop.attr-ibute" =~ re("DefHash::key"); # DOESN'T MATCHInvalid character: whitespace (1).
"property .attr" =~ re("DefHash::key"); # DOESN'T MATCHInvalid character: whitespace (2).
"property.attr " =~ re("DefHash::key"); # DOESN'T MATCHInvalid character: whitespace (3).
".attr " =~ re("DefHash::key"); # DOESN'T MATCHInvalid syntax: dot only.
"." =~ re("DefHash::key"); # DOESN'T MATCHInvalid syntax: double dot.
"..attr" =~ re("DefHash::key"); # DOESN'T MATCHInvalid syntax: dot without attr.
"attr." =~ re("DefHash::key"); # DOESN'T MATCHInvalid syntax: dot without attr (2).
"attr.." =~ re("DefHash::key"); # DOESN'T MATCHEmpty.
"" =~ re("DefHash::key"); # DOESN'T MATCH
- •
-
prop
Tags: anchored
Property key.
Examples:
Example #1.
"p" =~ re("DefHash::prop"); # matchesExample #2.
"_" =~ re("DefHash::prop"); # matchesExample #3.
"prop" =~ re("DefHash::prop"); # matchesExample #4.
"Prop2" =~ re("DefHash::prop"); # matchesExample #5.
"prop_" =~ re("DefHash::prop"); # matchesCannot start with digit.
"0prop" =~ re("DefHash::prop"); # DOESN'T MATCHInvalid character: dash.
"prop-erty" =~ re("DefHash::prop"); # DOESN'T MATCHInvalid character: whitespace.
"property " =~ re("DefHash::prop"); # DOESN'T MATCHEmpty.
"" =~ re("DefHash::prop"); # DOESN'T MATCHAttribute, not property.
"prop.attr" =~ re("DefHash::prop"); # DOESN'T MATCHAttribute, not property.
".attr" =~ re("DefHash::prop"); # DOESN'T MATCH
- •
-
prop_or_attr
Tags: anchored, capturing
Attribute key or property key.
All keys in defhash must match this pattern.
Examples:
Example #1.
"p" =~ re("DefHash::prop_or_attr"); # matchesExample #2.
"_" =~ re("DefHash::prop_or_attr"); # matchesExample #3.
"prop" =~ re("DefHash::prop_or_attr"); # matchesExample #4.
"Prop2" =~ re("DefHash::prop_or_attr"); # matchesExample #5.
"prop_" =~ re("DefHash::prop_or_attr"); # matchesCannot start with digit.
"0prop" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid character: dash.
"prop-erty" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid character: whitespace.
"property " =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHExample #9.
".attr" =~ re("DefHash::prop_or_attr"); # matchesExample #10.
"._attr" =~ re("DefHash::prop_or_attr"); # matchesExample #11.
".attr1.subattr2" =~ re("DefHash::prop_or_attr"); # matchesExample #12.
"prop.attr1" =~ re("DefHash::prop_or_attr"); # matchesExample #13.
"_prop._attr1" =~ re("DefHash::prop_or_attr"); # matchesExample #14.
"Prop.attr1.subattr2.Subattr3" =~ re("DefHash::prop_or_attr"); # matchesExample #15.
"_prop.attr1" =~ re("DefHash::prop_or_attr"); # matchesCannot start with digit (1).
".0attr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHCannot start with digit (2).
"prop.0attr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHCannot start with digit (3).
"prop.attr.0subattr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid character: dash (1).
".attr-ibute" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid character: dash (2).
"prop-erty.attribute" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid character: dash (3).
"prop.attr-ibute" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid character: whitespace (1).
"property .attr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid character: whitespace (2).
"property.attr " =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid character: whitespace (3).
".attr " =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid syntax: dot only.
"." =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid syntax: double dot.
"..attr" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid syntax: dot without attr.
"attr." =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHInvalid syntax: dot without attr (2).
"attr.." =~ re("DefHash::prop_or_attr"); # DOESN'T MATCHEmpty.
"" =~ re("DefHash::prop_or_attr"); # DOESN'T MATCH
Homepage
Please visit the project's homepage at <https://metacpan.org/release/Regexp-Pattern-DefHash>.
Source
Source repository is at <https://github.com/perlancar/perl-Regexp-Pattern-DefHash>.
Copyright and license
This software is copyright (c) 2021 by [email protected].
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Releases
Unchanged in 2 releases since Debian 12 (Bookworm).