Steve Grazzini wrote: > On Mon, Jul 07, 2003 at 01:00:22PM +0100, Rob Dixon wrote: > > Steve Grazzini wrote: > > > On Sun, Jul 06, 2003 at 11:20:03AM -0000, mark sony wrote: > > > > $_ = "The brown fox jumps over the lazy dog"; > > > > /the (\S+)(?{ $color = $^N }) (\S+)(?{ $animal = $^N })/i; > > > > > > $^N is new in 5.8.0. > > > In this case you can probably use $+ instead. > > > > $+ will return only the last captured string so you would > > need to process your text in two passes to get this result. > > $+ and $^N are updated every time a set of parens matches, so > code blocks inside the regex will see whatever the "last match" > was at that moment. > > $_ = "abcde"; > > m{ ((.) (?{ print $+ }))* }x; # prints "a","b","c"... > m{ ((.*) (?{ print $+ }))* a }x; # prints lots of stuff
Sure, but for Perl 5.6 the documentation says: WARNING: This extended regular expression feature is considered highly experimental, and may be changed or deleted without notice. Because of this I've always steered clear of it. I assume it's been validated in Perl 5.8? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]