in reply to Lookaround Assertions
my $copyright = qr{\b copyright (?:ed)? \b }xi; my $date = qr{\b (?:19|20) \d\d \b }x; if ($str =~ s/$copyright.{0,200}$date|$date.{0,200}$copyright/) {...}
You'd have to check with your real data if it's actually faster, but chances are that it will because it doesn't check every string position for a look-around.
If you want to stick with your look-around approach, you can use look-aheads, which support variable width regexes.
|
|---|