Meh, that's too little unneeded complication. Why not use the new (in perl 5.10.0) feature Keep too: print "<<$_>>\n" for "WhateverFooBlahBarMoreFooStuffBarMore" =~ /Foo\K.*?(?=Bar)/gx;
Really, if you add a capture around the word anyway, why do you need the lookaheads at all? print "<<$_>>\n" for "WhateverFooBlahBarMoreFooStuffBarMore" =~ /Foo(.*?)Bar/gx;
In reply to Re^2: Extracting substrings
by ambrus
in thread Extracting substrings
by bontchev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |