in reply to Re: url to html regex problem
in thread url to html regex problem

I use 2 regexps because it was the only way I could see to prevent urls that are already links from being linked again. Also notice that the first regexp is tweaked to preserve line breaks. Here's all the code I'm using for this:
my $urls = '(http|telnet|gopher|file|wais|ftp|mailto)'; my $ltrs = '\w'; my $gunk = '/#~:.?+=&%@!\-'; my $punc = '.:?\-'; my $junk = qq~="'>~; # added my $any = "${ltrs}${gunk}${punc}"; $text =~ s{([^$junk]\s*\b)($urls:[$any] +?)(?=[$punc]* [^$any]|$) }{$1 +<a href="$2">$2</a>}igox; $text =~ s{^($urls:[$any] +?)(?=[$punc]* [^$any]|$) }{<a href="$1">$1< +/a>}igox;
I swear this works on windows, but not our BSD. Any speculation on what could cause that? Thanks..