Hi, can anyone help me with a regex problem? I’m trying to use it to remove certain expressions from an email field in a mailform, and although it works great for almost everything it won’t remove anything that has a backslash – n, r, etc. This is what I’ve been using:
[code=php]preg_replace(“/[n|r|t]/”,” “,”$string”)
I’ve tried any number of different kinds of syntax and also str_replace and ereg_replace and none of these will remove any of those expressions. All the sites I’ve looked at and other forums I’ve asked have said this should work, but it doesn’t.
Curiously, after many hours of googling, I found ONE site which said that the regular expression should have three backslashes – []]
Many thanks to anyone can shed any light on this!