View Single Post
Old 10-07-2003, 06:28 PM   #60
hacker
Technology Mercenary
hacker plays well with othershacker plays well with othershacker plays well with othershacker plays well with othershacker plays well with othershacker plays well with othershacker plays well with othershacker plays well with othershacker plays well with othershacker plays well with othershacker plays well with others
 
hacker's Avatar
 
Posts: 614
Karma: 2561
Join Date: Feb 2003
Location: New London, CT
Device: Direct Neural Implant
Speaking of regular expressions..

Quote:
Originally Posted by Alexander
The particular RegEx I wrote for MyYahoo Mail is more complex; it uses techniques like lookahead assertion.
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++
hacker is offline