cosmicperl has asked for the wisdom of the Perl Monks concerning the following question:
while ($html =~ /\b$WHATWANT{'term'}'?s?\b/gis) { $termstotal++; } ## +End while while ($html =~ /<body>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/body>/gis) { +$termsbody++; } ## End while while ($html =~ /<title>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/title>/gis) +{ $termstitle++; } ## End while while ($html =~ /<h1.*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/h1>/gis) { $ +termshead1++; } ## End while while ($html =~ /<h2.*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/h2>/gis) { $ +termshead2++; } ## End while while ($html =~ /<h3.*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/h3>/gis) { $ +termshead3++; } ## End while while ($html =~ /<h4.*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/h4>/gis) { $ +termshead4++; } ## End while while ($html =~ /<h5.*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/h5>/gis) { $ +termshead5++; } ## End while while ($html =~ /<h6.*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/h6>/gis) { $ +termshead6++; } ## End while while ($html =~ /alt=\".*?\b$WHATWANT{'term'}'?s?\b.*?\"/gis) { $terms +alt++; } ## End while while ($html =~ /alt=\'.*?\b$WHATWANT{'term'}'?s?\b.*?\'/gis) { $terms +alt++; } ## End while while ($html =~ /<a .*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/a>/gis) { $t +ermsa++; } ## End while while ($html =~ /<\!--.*?\b$WHATWANT{'term'}'?s?\b.*?-->/gis) { $terms +comment++; } ## End while while ($html =~ /<li.*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/li>/gis) { $ +termsbullet++; } ## End while while ($html =~ /href=\".*?$WHATWANT{'term'}'?s?.*?\"/gis) { $termshre +f++; } ## End while while ($html =~ /href=\'.*?$WHATWANT{'term'}'?s?.*?\'/gis) { $termshre +f++; } ## End while while ($html =~ /<p.*?>.*?\b$WHATWANT{'term'}'?s?\b.*?<\/p>/gis) { $te +rmsp++; } ## End while
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Slow regexp
by blokhead (Monsignor) on Feb 02, 2005 at 03:09 UTC | |
|
Re: Slow regexp
by Roy Johnson (Monsignor) on Feb 02, 2005 at 03:21 UTC | |
|
Re: Slow regexp
by holli (Abbot) on Feb 02, 2005 at 03:32 UTC | |
|
Re: Slow regexp
by manigandans (Initiate) on Feb 02, 2005 at 14:36 UTC |