use Regexp::Pattern; # exports re() my $re = re("Example::re1");
This is regexp for blah.
A longer description in Markdown format.
Examples:
"123-456" =~ re("Example::re2"); # matches
Another example that matches.
"123-456-78901" =~ re("Example::re2"); # matches
An example that does not match.
123456 =~ re("Example::re2"); # doesn't match
An example that does not get tested.
123456 =~ re("Example::re2"); # doesn't match
This is a regexp for blah blah.
...
This is a dynamic pattern which will be generated on-demand.
The following arguments are available to customize the generated pattern:
Choose variant.
Examples:
An example that matches.
"123-456" =~ re("Example::re3", {variant=>"A"}); # matches
An example that doesn't match.
"123-456" =~ re("Example::re3", {variant=>"B"}); # doesn't match
This is a regexp that does capturing.
Examples:
"123-456" =~ re("Example::re4"); # matches, $1=123, $2=456 "foo-bar" =~ re("Example::re4"); # doesn't match
This is another regexp that is anchored and does (named) capturing.
Examples:
"123-456" =~ re("Example::re5"); # matches, $+{"cap1"}=123, $+{"cap2"}=456 "something 123-456" =~ re("Example::re5"); # doesn't match
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.