[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] sed regexp question
- Subject: [ale] sed regexp question
- From: esoteric at denali.atlnet.com (Wandered Inn)
- Date: Tue, 10 Jul 2001 20:50:23 -0400
"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.