note 13269 deleted from function.preg-replace by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:28:48 +0000 |
| Subject: | note 13269 deleted from function.preg-replace by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57466@lists.php.net to get a copy of this message | ||
Note Submitter: scf@spamcop.net
----
I used this function to implemnt an Everything2 style system where [square brackets] in user
submitted text automatically become hyperlinks.
$patterns = array ("/\[([ \w]+)\]/","/\[([ \w]+)\|([ \w]+)\]/");
$replace = array ("<a
href=\"node.php?nodeshell_name=\\1\">\\1</a>","<a
href=\"node.php?nodeshell_name=\\1\">\\2</a>");
$new_body= preg_replace ($patterns, $replace, $body_text);