Page 1 of 1

checking a var for unwanted chars

Posted: Fri Dec 11, 2009 12:10 pm
by rufee
Hello
I have a question
How to check a variable for unwanted chars such as " ' ` {}[]()<>/?|" and so on?

Re: checking a var for unwanted chars

Posted: Fri Dec 11, 2009 12:27 pm
by JNettles
Regex.

Re: checking a var for unwanted chars

Posted: Fri Dec 11, 2009 12:33 pm
by rufee
JNettles wrote:Regex.
But its deprecated in 5.3.0
any solution to that ?

Re: checking a var for unwanted chars

Posted: Fri Dec 11, 2009 1:30 pm
by AbraCadaver
rufee wrote:
JNettles wrote:Regex.
But its deprecated in 5.3.0
any solution to that ?
Regex, deprecated? That would be horrible. The ereg_* functions are deprecated so use preg_match() or preg_replace(), etc...

Re: checking a var for unwanted chars

Posted: Fri Dec 11, 2009 2:03 pm
by requinix
rufee wrote:such as " ' ` {}[]()<>/?|"
How about a list more specific than just "such as"? Maybe you want just letters and numbers?