Regexp::FieldsNamed capture groups | |
Download |
Regexp::Fields Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Steve Grazzini
- Publisher web site:
- http://search.cpan.org/~grazz/
Regexp::Fields Tags
Regexp::Fields Description
Named capture groups Regexp::Fields is a Perl module that adds the extended (?< name > ...) pattern to Perl's regular expression language. This works like an ordinary pair of capturing parens, but after a match you can use $&{name} instead of $1 (or whichever $N) to get at the captured substring.The %{&} hash is global, like all punctuation variables. Like $1 and friends, it's dynamically scoped and bound to the "last match".SYNOPSIS use Regexp::Fields qw(my); use strict; my $rx = qr/Time: (?..):(?..):(?..)/; if (/$rx/) { print "The time was: $&{hrs}:$&{min}:$&{sec}\n"; # or: "The time was: $hrs:$min:$sec\n"; # or: "The time was: $1:$2:$3\n"; } Requirements: · Perl
Regexp::Fields Related Software