|
Posted by Janwillem Borleffs on 12/17/05 23:39
ironcito wrote:
> I have a string. I want to replace every character, except letters
> and numbers, with a space. For example, "$%Hel**lo #World@!" would
> become " Hel lo World ". How can I tell php to "replace everything
> except this" instead of "replace this"?
>
$str = '$%Hel**lo #World@';
print preg_replace('/[^a-z\d]/i', ' ', $str);
JW
Navigation:
[Reply to this message]
|