Wiggins d Anconia wrote:
Jason Dusek wrote:
Hi Everyone,
Hello,
What is good way to pull the href from a link in html? If I have links like:
meow woof moo bark bahh <a href="here_kitty" class="domestic">meow</a> bahh moo bark
There's are modules that help you do it, but this may work for what you need:
my @href = $html =~ m/href\=\"((https?\:\/\/)?[\/\w\.\-]+)\"/ig;
What if the link is ftp, mailto, etc. Contains username/password information? a Port? How about a query string? Javascript? White space around the "="..... To many questions unanswered, unanswered questions cause headaches, stick with the modules :-)...
I did say "may" :). For here_kitty it works but yes, modules are the way to go also because you may do this in lots of scripts and then if they add a new protocol, say , perl://, then all you have to do is update your module and all your scripts magically work with the new protocol without a thousand edits.
http://danconia.org
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>