Re: http://

From: Date: Fri, 08 Feb 2002 04:09:15 +0000
Subject: Re: http://
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-83962@lists.php.net to get a copy of this message
Hi John: jtjohnston wrote: > > I'm looking for a function that will find occurences of urls in any > given string and do this: > > http://www.nowhere.com/ > becomes > <a > href="http://www.nowhere.com/">http://www.nowhere.com/</a> <?php $Val = "body of text you want to process..."; $Val = eregi_replace("(http://|https://|ftp://|gopher://|news:|mailto:)([[:alnum:]/!#$%&'()*+,.:;=?@_~-]+)([[:alnum:]/!#$%&'()*+:;=?@_~-])", '<a href="\\1\\2\\3">\\1\\2\\3</a>', "$Val"); ?> You'll have to undo the line wrapping before you use that. Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution 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 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.general (#83962) next »