Re: Create a link where http://
| From: | Analysis & Solutions | Date: | Mon, 29 Jul 2002 13:18:28 +0000 |
| Subject: | Re: Create a link where http:// | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110163@lists.php.net to get a copy of this message | ||
On Mon, Jul 29, 2002 at 08:12:33AM -0400, Jesse Lawrence wrote:
> would like to automatically turn any instance of
> http://whatever into a link, without requiring the
> viewers to enter html.
The mailing list archive:
http://groups.google.com/groups?group=php.general
Good search terms:
hyperlink "regular expression"
Yields this article:
http://groups.google.com/groups?q=hyperlink+%22regular+expression%22+group:php.general&hl=en&lr=&ie=UTF-8&safe=off&selm=3A248B2C.13ED233C%40analysisandsolutions.com&rnum=2
Which has an excellent [shamelessly patting myself on the back] hyperlink
regular expression for ereg*:
"(http://|https://|ftp://|gopher://|news:|mailto:)
([[:alnum:]/!#$%&'()*+,.:;=?@~-]+)([[:alnum:]/!#$%&'()*+:;=?@~-])"
Do note, if the last character of the URI is a "," or "." it assumes those
are punctuation and leaves them off.
Enjoy,
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409