my $regex = qr/\d\s+foo/; $some_string =~ /($regex)[^\r\n]*($regex)/;
Also, your solution doesn't scale (if capturing is desired). He can't say, for example, the following while capturing what $regexp matches:
my $regex = qr/\d\s+foo/; $some_string =~ /(?:$regex[^\r\n]*)*($regex)/;
In reply to Re^3: PCRE: Repeating Subpattens After Intervening Characters
by ikegami
in thread PCRE: Repeating Subpattens After Intervening Characters
by schnarff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |