NAME

Regexp::Pattern::Example - An example Regexp::Pattern::* module

VERSION

This document describes version 0.2.14 of Regexp::Pattern::Example (from Perl distribution Regexp-Pattern), released on 2020-04-01.

SYNOPSIS

use Regexp::Pattern; # exports re()
my $re = re("Example::re1");

DESCRIPTION

Regexp::Pattern is a convention for organizing reusable regex patterns.

PATTERNS

  • re1

  • re2

    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
  • re3

    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:

    • variant

      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
  • re4

    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
  • re5

    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

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Regexp-Pattern.

SOURCE

Source repository is at https://github.com/perlancar/perl-Regexp-Pattern.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Regexp-Pattern

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.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020, 2019, 2018, 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.