Re: question about str_replace function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roman Neuhauser wrote:
> # jochem@xxxxxxxxxxxxx / 2007-01-08 11:35:06 +0100:
>> Dick Jiang wrote:
>>>  I think you'd better use regular expression to replace the word
>> agreed - only it a serious dive in the deep end of regexps - the OP may
>> have to use a negative lookahead assertion, something like:
>>
>> $string="avenue 1, ave 1 both have av+e :-)";
>> $words = preg_replace("#\\bave(?!nue)#", "avenue", $string);
> 
> That'll also make "average" into "avenuerage". A word-boundary assertion
> should (admittedly, I didn't check) be fine on both sides: '#\bave\b#'.

I think you are correct.

> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux