note 49473 added to function.preg-replace
| From: | levi at kodern dot com | Date: | Sat, 29 Jan 2005 10:58:43 +0000 |
| Subject: | note 49473 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84157@lists.php.net to get a copy of this message | ||
It took me a couple hours to figure this one out as I'm a newbie at regular expressions, and no
one had posted about it. This will remove the parentheses and all any characters inside of them.
i.e. phone number with parentheses or Yahoo's news feed.
preg_replace(" (\(.*?\))", "", $string)
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49473
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49473&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49473&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49473&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49473&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49473&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49473&report=yes
Search -- http://master.php.net/manage/user-notes.php