chris and justin, you guys rock. thanx for pointing towards str_replace().
my code works now. thanx!

"Justin French" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday, November 16, 2003, at 02:31  PM, erythros wrote:
>
> > ok, so i'm stupid. how do i replace all '? ' with '?? '....
> >
>
> No need for regular expressions here.
>
> <?
> $str = 'well, how do I do this? should i experiment?';
> $newStr = str_replace('? ','?? ',$str);
> echo $newStr;
> // should echo well, how do I do this?? should i experiment?
> ?>
>
> Unless you want ANY white space (\n, \t, etc) instead of just spaces,
> an ereg would be better.  I prefer preg_replace():
>
> <?
> $str = 'well, how do I do this? should i experiment?';
> $newStr = str_replace('/?(\s)/','??\\1',$str);
> echo $newStr;
> ?>
>
>
> Justin French

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

Reply via email to