in reply to Re: A regexp to parse nested brackets containing strings
in thread A regexp to parse nested brackets containing strings
So you can't make $InnerRe anchorred at the beginning, and not anchorred at the beginning, all in the same match invocation.
It's not a problem. My solution even does this.
$\ = "\n"; my $re; $re = qr/ a (??{ $re }) c | b /x; print 'aabcc' =~ /^$re/ ||0; # 1 print '!aabcc' =~ /^$re/ ||0; # 0 First call is anchored to start. print 'a!abcc' =~ /^$re/ ||0; # 0 Recursive call is anchored to pos. print 'aa!bcc' =~ /^$re/ ||0; # 0 Recursive call is anchored to pos.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: A regexp to parse nested brackets containing strings
by rodion (Chaplain) on Sep 24, 2006 at 08:27 UTC | |
by ikegami (Patriarch) on Sep 24, 2006 at 12:25 UTC |