[ale] sed regexp question
Wandered Inn
esoteric at denali.atlnet.com
Tue Jul 10 20:50:23 EDT 2001
"Joseph A. Knapka" wrote:
> Hey, you used newlines! I can see you're a Perl stylist committed
> to producing maintainable code. :-)
Yeah, every now and then, I have to look at my own code. :)
>
> Your version seems to only get the first URL on a line.
> Mine gets 'em all. Therefore Tcl is obviously superior!
> <wiping foam from mouth with page torn from "Programming Perl">
#!/usr/bin/perl
while (<>) {
chomp;
@data = split;
foreach $url (@data) {
$url =~ /[Hh][Rr][Ee][Ff]=/ && printf "%s\n",
substr($url, index($url, "=") + 2,
index($url, ">") - index($url, "=") - 3);
}
}
Clean that page off and put it back in that book nicely. :)
--
Until later: Geoffrey esoteric at denali.atlnet.com
"Great spirits have always found violent opposition from mediocre minds.
The latter cannot understand it when a man does not thoughtlessly submit
to hereditary prejudices but honestly and courageously uses his
intelligence." - Albert Einstein
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.
More information about the Ale
mailing list