Depending on the complexity of your $target and your data, you may find a gain by breaking your search up:
my $target = shift || 'word'; $target = qr/$target/; my $re = qr/a=<([^>]+)>/; while( <DATA> ) { next unless /$re/; my $s = $1; print "[$s]\n" if $s =~ /$target/; }
In reply to Re: Removing backtracking from a .*? regexp
by Anonymous Monk
in thread Removing backtracking from a .*? regexp
by grinder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |