in reply to Evaluating code in a regex at runtime: (??{...})
Note that the contents of the match are still accessible via a named capture group:
#! perl use Modern::Perl; ('a' x 100) =~ /(?<match>(??{'(.)' x 100}))/; say $+{match};
Output:
12:28 >perl 504_SoPW.pl aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 12:28 >
See Capture groups.
Hope that helps,
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Evaluating code in a regex at runtime: (??{...})
by LanX (Saint) on Jan 28, 2013 at 07:34 UTC | |
by Athanasius (Archbishop) on Jan 28, 2013 at 08:44 UTC | |
by LanX (Saint) on Jan 28, 2013 at 09:09 UTC |
In Section
Seekers of Perl Wisdom