note 53778 added to function.preg-replace
| From: | shockzor at osu1 dot php dot net | Date: | Mon, 13 Jun 2005 06:21:55 +0000 |
| Subject: | note 53778 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90339@lists.php.net to get a copy of this message | ||
Links to an article on Wikipedia using html/xhtml code.
<?php
$data = "My name is <WIKI:John_doe/>.";
echo preg_replace("%<WIKI:(\w+)\s*/?>%", "<a href=\"http://en.wikipedia.org/wiki/$1\">$1</a>",
$data);
?>
Links to an article on Wikipedia using BB code.
<?php
$data = "My name is [WIKI=John_doe].";
echo preg_replace("/\[WIKI=(\w+)\]/", "<a href=\"http://en.wikipedia.org/wiki/$1\">$1</a>",
$data);
?>
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53778
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53778&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53778&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53778&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53778&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53778&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53778&report=yes
Search -- http://master.php.net/manage/user-notes.php