note 15961 deleted from function.preg-replace by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 23:28:55 +0000 |
| Subject: | note 15961 deleted from function.preg-replace by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23564@lists.php.net to get a copy of this message | ||
better solution for the last example:
$text="hello [b]this[/b] is a [url=http://www.test.com]link[/url]
test with [u]underline[/u] and [i]italic[/i]";
echo($text."-->");
// for [url]
$html=preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/msi","<a
href=\"\\1\">\\2</a>",$text);
// for [u],[b],[i]
$html=preg_replace("/\[(b|u|i)\](.*?)\[\/(\\1)\]/msi","<\\1>\\2</\\1>",$html);
echo($html);