On 14 Jan 2001 19:40:28 -0800, Toby Butzon <[EMAIL PROTECTED]> wrote:
>Ok, so you want to replace ONLY the word "boy" with the word "girl"... you
>don't want to touch "boys".
>
>Perhaps str_replace("boy ", "girl ", $myStr) would do the trick?

Better yet, preg_replace("/\bboy\b/i", "girl", $myStr) or
ereg_replace("[[:space:][:punct:]]boy[[:space:][:punct:]]", "girl", $myStr).
Those would also match things like "boy,", "boy:" or "boy)".

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to