pglenski has asked for the wisdom of the Perl Monks concerning the following question:
use English; $_ = "foo a baz bar"; /foo # Match starting at foo (?: # Complex expression: (?!baz) # make sure we're not at the beginning of baz . # accept any character )* # any number of times bar # and ending at bar /x; print "$_ \n"; print " \$1 = $1 \n"; print " \$2 = $2 \n"; print " \$& = $MATCH \n"; print " \$` = $PREMATCH \n"; print " \$' = $POSTMATCH \n"; print " \$+ = $LAST_PAREN_MATCH \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex look ahead
by Tanktalus (Canon) on Aug 30, 2006 at 20:12 UTC | |
|
Re: Regex look ahead
by imp (Priest) on Aug 31, 2006 at 04:52 UTC | |
|
Re: Regex look ahead
by Fletch (Bishop) on Aug 30, 2006 at 20:16 UTC |