note 77934 deleted from function.preg-replace by danbrown
| From: | danbrown@php.net | Date: | Fri, 28 Nov 2008 19:47:23 +0000 |
| Subject: | note 77934 deleted from function.preg-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147140@lists.php.net to get a copy of this message | ||
Note Submitter: jefkin at gmail dot com
----
@ Santosh Patnaik
The perl regular expression engine will handle this expression better and much faster by using the
word boundry escape code \b. Though it may not be obvious except to long time perl geeks such as I
:)
so:
// Expect and get 'pa pa pa pa'
echo preg_replace('
\bma\b', 'pa', 'ma ma ma ma');
Jeff