1Regexp::Pattern::ExamplUes(e3r)Contributed Perl DocumentRaetgieoxnp::Pattern::Example(3)
2
3
4
6 Regexp::Pattern::Example - An example Regexp::Pattern::* module
7
9 This document describes version 0.2.14 of Regexp::Pattern::Example
10 (from Perl distribution Regexp-Pattern), released on 2020-04-01.
11
13 use Regexp::Pattern; # exports re()
14 my $re = re("Example::re1");
15
17 Regexp::Pattern is a convention for organizing reusable regex patterns.
18
20 • re1
21
22 • re2
23
24 This is regexp for blah.
25
26 A longer description in Markdown format.
27
28 Examples:
29
30 "123-456" =~ re("Example::re2"); # matches
31
32 Another example that matches.
33
34 "123-456-78901" =~ re("Example::re2"); # matches
35
36 An example that does not match.
37
38 123456 =~ re("Example::re2"); # doesn't match
39
40 An example that does not get tested.
41
42 123456 =~ re("Example::re2"); # doesn't match
43
44 • re3
45
46 This is a regexp for blah blah.
47
48 ...
49
50 This is a dynamic pattern which will be generated on-demand.
51
52 The following arguments are available to customize the generated
53 pattern:
54
55 • variant
56
57 Choose variant.
58
59 Examples:
60
61 An example that matches.
62
63 "123-456" =~ re("Example::re3", {variant=>"A"}); # matches
64
65 An example that doesn't match.
66
67 "123-456" =~ re("Example::re3", {variant=>"B"}); # doesn't match
68
69 • re4
70
71 This is a regexp that does capturing.
72
73 Examples:
74
75 "123-456" =~ re("Example::re4"); # matches, $1=123, $2=456
76
77 "foo-bar" =~ re("Example::re4"); # doesn't match
78
79 • re5
80
81 This is another regexp that is anchored and does (named) capturing.
82
83 Examples:
84
85 "123-456" =~ re("Example::re5"); # matches, $+{"cap1"}=123, $+{"cap2"}=456
86
87 "something 123-456" =~ re("Example::re5"); # doesn't match
88
90 Please visit the project's homepage at
91 <https://metacpan.org/release/Regexp-Pattern>.
92
94 Source repository is at
95 <https://github.com/perlancar/perl-Regexp-Pattern>.
96
98 Please report any bugs or feature requests on the bugtracker website
99 <https://rt.cpan.org/Public/Dist/Display.html?Name=Regexp-Pattern>
100
101 When submitting a bug or request, please include a test-file or a patch
102 to an existing test-file that illustrates the bug or desired feature.
103
105 perlancar <perlancar@cpan.org>
106
108 This software is copyright (c) 2020, 2019, 2018, 2016 by
109 perlancar@cpan.org.
110
111 This is free software; you can redistribute it and/or modify it under
112 the same terms as the Perl 5 programming language system itself.
113
114
115
116perl v5.38.0 2023-07-21 Regexp::Pattern::Example(3)