Replacing everything but letters, numbers and hyphens...
Posted: Wed Jul 20, 2005 6:01 am
Hey there,
I asked a little while back how to replace everything but numbers and letters in a string? Well, I ended up with this code:
The only problem is that it does not remove these: _
I would much prefer it to not remove hyphens (-)
Is there anyway I can make the above code not remove hyphens from a string of text?
Ben
I asked a little while back how to replace everything but numbers and letters in a string? Well, I ended up with this code:
Code: Select all
$string = preg_replace('/ї^\wa-z0-9]/i', '', $string);I would much prefer it to not remove hyphens (-)
Is there anyway I can make the above code not remove hyphens from a string of text?
Ben