View Single Post
Old 10-08-2003, 03:03 AM   #61
Alexander Turcic
Fully Converged
Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.Alexander Turcic ought to be getting tired of karma fortunes by now.
 
Alexander Turcic's Avatar
 
Posts: 18,163
Karma: 14021202
Join Date: Oct 2002
Location: Switzerland
Device: Too many to count here.
Quote:
Originally Posted by hacker
Speaking of regular expressions, here is one I wrote in my own perl web spider (used to fetch and convert webpages into Plucker format), that will strip Javascript and CSS style blocks from the page before it is parsed (since we don't deal with those elements, they're only taking up useless space in RAM at parse time, why not remove them!)

$content =~ s!<(s(?:cript|tyle))[^>]*>.*?</\1>!!gis

Works like a champ. Look at that beautiful backtracking and how I recycle the redundant parts of the regex, to combine two into one.

Perl++
Heh... nice one. Why not compete for the most complex regular expression
Alexander Turcic is offline