in reply to Slow regexp
Failing that, you might try combining many of these into one search, so you're not looping through the data so much. Maybe something like:
Your two patterns for single quote vs double quote could be reduced to one, likewhile ($html =~ /<(\w+).*?>\b$WHATWANT{'term'}?s?\b.*?</\1>/gis) { my $tag = $1; $tag =~ tr/A-Z/a-z/; if ($tag eq 'title') { } elsif ($tag eq 'h1') { #.... }
while ($html =~ /href=(['"]).*?$WHATWANT{'term'}'?s?.*?\1/gis) { $term +shref++; } ## End while
|
|---|