I have a regular expression i'm using to simply look for "not allowed" charaters. Theres nothing to special about it just checking a complete string for certian characters. My problem is trying to allow quote marks (").
if (eregi("[[:alnum:][:space:]]", $_POST['text']))
works fine and returns just like i want it to. Now i want to add quotes.
if (eregi("[[:alnum:][:space:]"]", $_POST['text']))
Parse error when done like that. So now lets escape it with a "\".
if (eregi("[[:alnum:][:space:]\"]", $_POST['text']))
That works but actually inserts a "\" in front of every quote in the string. So if the string was:
abc "def" ghi
it becomes:
abc \"def\" ghi
Now i know i could go thru and strip out the slashes after i run the ereg but that seems like the wrong way to do it. I'm just alittle confused at this point, i don't understand how "eregi" can inject characters into my original string. On top of that if not escaping the quotes creates a parse error and escaping injects slashes, what is the right way to add the quotes? Thanks in advance for any help.