For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2004 > Parsing the hyperlink?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Parsing the hyperlink?
Ron B

2004-03-29, 3:33 pm

I'm running my own version of bulletinboard and I have a little problem
with hyperlinks. I'd like to make them really work. So if posted message
includes http://blaablaablaa it would be a hyeprlink when reader opens
the message. Messages are stored in .html files so it's quite easy to
add <a href="http://blaablaablaa">http://blaablaablaa</a> to original
file by my cgi-parser.

I know it's something like:

if $message =~ /http:\/\//

But what else?

Wiggins D'Anconia

2004-03-29, 9:31 pm

Ron B wrote:
> I'm running my own version of bulletinboard and I have a little problem
> with hyperlinks. I'd like to make them really work. So if posted message
> includes http://blaablaablaa it would be a hyeprlink when reader opens
> the message. Messages are stored in .html files so it's quite easy to
> add <a href="http://blaablaablaa">http://blaablaablaa</a> to original
> file by my cgi-parser.
>
> I know it's something like:
>
> if $message =~ /http:\/\//
>
> But what else?
>
>


Scrap the regex, go with a module:

http://search.cpan.org/~rosch/URI-Find-0.13/
http://www.perladvent.org/2002/1st/

If you are interested in why I say you should skip the regex,

http://aspn.activestate.com/ASPN/Co...Rx/Recipe/59864

Thanks for making me look this up, time to install YAMod....

http://danconia.org
Ron B

2004-03-30, 4:38 am

Thanks.

I think I'll use regex this time, 'cause it fits the purpose good
enough. But it's really nice thing to know the module for the future
versions of my script.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com