Regexp...xample(3pm)
π Regexp::Pattern::Example β the Regexp...xample(3pm) page, but make it cute π
okay bestie, welcome to the Regexp::Pattern::Example manual page (that's the Regexp...xample(3pm) one, the terminal just truncates it because it's dramatic like that). it's an example Regexp::Pattern::* module, and yes it's literally called Example, we love a self-aware king. π«Ά
β¨ NAME β¨
Regexp::Pattern::Example β an example Regexp::Pattern::* module. that's it, that's the whole name section, no cap. π
πΈ VERSION πΈ
so this doc describes version 0.2.14 of Regexp::Pattern::Example β and it comes from the Perl distribution Regexp-Pattern, released on 2020-04-01. iconic date, no notes. π
π SYNOPSIS π
the vibe check, in code:
use Regexp::Pattern; # exports re()
my $re = re("Example::re1");
yeah. that's how you grab a pattern. Regexp::Pattern exports re() and you just... call it. slay. β¨
π¦ DESCRIPTION π¦
so here's the whole thing: Regexp::Pattern is a convention for organizing reusable regex patterns.
that's the entire description. a convention. organizing. reusable regex. it's giving infrastructure, it's giving "we're not writing that regex again", it's giving main character energy for your codebase. periodt. π
π PATTERNS π
okay this is the good part, the actual patterns. buckle up. π
re1
that's it. that's the entry. no description, no examples, just vibes and a name. respect. π
re2
this is regexp for blah. π
and here's a longer description, in Markdown format β yes, Markdown, because we're fancy.
Examples:
one that matches:
"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
and an example that does not get tested:
123456 =~ re("Example::re2"); # doesn't match
(yes, those last two look identical. not me noticing. it's fine. it's in the original. moving on bestie π)
re3
this is a regexp for blah blah.
...
this one is a dynamic pattern β it gets generated on-demand. so it's not sitting there waiting, it's being crafted, live, when you ask for it. very main character. β¨
the following arguments are available to customize the generated pattern:
variantβ choose variant. that's the whole description, we keep it real. π
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. so it's out here grabbing groups, we love a regex with hands. π«Ά
Examples:
"123-456" =~ re("Example::re4"); # matches, $1=123, $2=456
"foo-bar" =~ re("Example::re4"); # doesn't match
first one matches and you get $1=123 and $2=456. second one? nope. doesn't match. bye. π
re5
this is another regexp that is anchored and does (named) capturing. anchored means it's not letting anything sneak in at the edges β it's got boundaries, we respect that. π§
Examples:
"123-456" =~ re("Example::re5"); # matches, $+{"cap1"}=123, $+{"cap2"}=456
"something 123-456" =~ re("Example::re5"); # doesn't match
so the first one matches and gives you the named captures $+{"cap1"}=123 and $+{"cap2"}=456. the second one has something hanging out in front of it and because it's anchored, it does not match. rude? no. correct. π
π HOMEPAGE π
please visit the project's homepage at <https://metacpan.org/release/Regexp-Pattern>.
like, actually visit it. go. π¦
β SOURCE β
source repository is at <https://github.com/perlancar/perl-Regexp-Pattern>.
go read the code bestie, it's right there. π
π BUGS π
please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Regexp-Pattern>.
and when you submit a bug or a request, please include a test-file or a patch to an existing test-file that illustrates the bug or the desired feature. seriously. a reproduction is the whole gift. don't just say "it's broken", show us. π
π«Ά 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.
and that's the page!! π written for perl v5.36.0, dated 2022-11-29, and yeah the header still says Regexp...xample(3pm) because terminals love to abbreviate. mwah. take care of your regexes, hydrate, and remember: reuse your patterns. πβ¨π
π¦ where this page comes from
- debian bookworm: libregexp-pattern-perl 0.2.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libregexp-pattern-perl 0.2.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libregexp-pattern-perl 0.2.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libregexp-pattern-perl 0.2.14-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms