You are here: errors using preg_replace « PHP Programming Language « IT news, forums, messages
errors using preg_replace

Posted by lawrence k on 09/27/47 12:01

I wanted to take some input and change it so that all the plain text
URLs got wrapped in HTML hyperlinks. I found a bit of preg_replace on
this site, which I thought I could use:

http://www.roscripts.com/PHP_regular_expressions_examples-136.html


Sad to say, I've not been able to get that code to work. Here is what
I'm doing:

$message = addslashes($message);
$message = htmlentities($message);
$message = preg_replace('\b(https?|ftp|file)://[-A-Z0-9+&@#/%?
=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]','<a href="\0">\0</a>', $message);


Here is the error that I'm getting:

Warning: preg_replace(): Delimiter must not be alphanumeric or
backslash in
/var/www/vhosts/cyberbitten.com/httpdocs/sharedCode/
addNewChatMessage.php on
line 42


Can anyone tell me what I'm getting wrong here?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация