For the RegExps gurus!
| From: | _lallous | Date: | Wed, 05 Sep 2001 10:17:21 +0000 |
| Subject: | For the RegExps gurus! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-66018@lists.php.net to get a copy of this message | ||
I want to write a RegExp that converts something like this:
$mem = "
Hello world! http://www.helloworld.com\n
Hello world! ftp://ftp.server.com\n
Hello world www.helloworld.com"
how can I write a single regexp that converts $mem to this:
$mem = "
Hello world! <a
href="http://www.helloworld.com">http://www.helloworld.com</a>\n
Hello world! <a href="ftp://ftp.server.com">ftp://ftp.server.com</a>\n
Hello world <a
href="http://www.helloworld.com">http://www.helloworld.com</a>"
As you noticed that the second line didn't have the protocol specifier and
it took by default "http://" and the ones that had a protocol
specifier were
kept as is.