SPUG: Ignore: testing new mail server
andrew at sweger.net
Sun Jan 9 21:01:21 PST 2005
This should have arrived through the new mail server. Hope it works.
I just had some fun using split() to break up a HTML document into HTML
tags and the text found between them.
local $/; # enable slurp mode
my $file = <>; # slurp file
$file =~ s/\n+/ /g; # replace newlines
my @parts = split /(?=<)|(?<=>)/s, $file;
That regex broken out:
(?= < ) # matches zero width (intercharacter) before '<'
(?<= > ) # matches zero width after '>'
Seemed like a fun way to break up some HTML so I could get at its parts
without actually parsing for something more serious (I was interested in
the changes to versions of the file sans HTML markup, but needed to retain
the markup in the stream).
Andrew B. Sweger -- The great thing about multitasking is that several
things can go wrong at once.
More information about the spug-list