I have a form input to a discussion forum and I would like to make all of the links hyperlinks automatically so people don't have to put in the HTML code. I did (stole) this in PERL and here's what it looks like:
#!/usr/bin/perl
use strict;
print my $text = "Reckoning is at http://reckoning.org/.\n";
my $urls = '(http|telnet|gopher|file|wais|ftp)';
my $ltrs = '\w';
my $gunk = '/#~:.?+=&%@!-';
my $punc = '.:?-';
my $any = "${ltrs}${gunk}${punc}";
$text =~ s{
\b
(
$urls :
[$any]
+?
)
(
?=
[$punc]*
[$any]
|
$
)
}{<a href='$1'>$1</a>}igox;
print $text;
How do I do the same in PHP? I am having 0 luck so far.
Thanks,
-Trademaster_Adam
http://www.bartertown.com/