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