in reply to Keeping lookahead assertion from looking to the end of the string?
"start b2 start b2 end start b2 b2 end"
then the only way I see to do it would be to use functions like index and substr to iterate over the string removing pieces of it until it is in the form you want before regex'ing it.
If on the slight chance you will always see a start marker, some text that does NOT include another start marker, and then an end marker, you can simply do this:
my $str = "start b2 end start b2 b2 end start b2 end"; if ($str =~ /.*start((.*?b2.*?b2).*?)end/) { print "$1 is between \"start\" and \"end\"\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Keeping lookahead assertion from looking to the end of the string?
by swackerl (Initiate) on Sep 05, 2002 at 18:22 UTC | |
by swackerl (Initiate) on Sep 05, 2002 at 22:48 UTC | |
|
Re: Re: Keeping lookahead assertion from looking to the end of the string?
by jsprat (Curate) on Sep 05, 2002 at 22:06 UTC |