in reply to Re: In need of a stupid regex trick
in thread In need of a stupid regex trick
is it possible to put a character group (and quantify it with a * + ? or {} ) into a look-ahead match?Sure it is. Anything you can do in a plain match, you can do in a lookahead match.
For lookbehind, it's a different matter: you can only use fixed length lookbehind, so quantifiers (like * and +), and varied-length alternatives, are out. BTW if all alternatives have the same length, it is allowed, as in:
$_ = q[There's food at the bar.]; while(/(?<=foo|bar)(\S+)/g) { print "$1\n"; }
|
|---|