Hello Everyone
This might be slightly offtopic since I'm not sure its php related but....
I'm working on a script where some inputdata is taken for further
processing. For validation purposes I want to make sure certain chars are
not part of the input. Basically stuff like $ * :; etc...
So I'm using ereg(pattern, input) to see if the pattern matches or not.
Example
if(ereg($pattern, $input))
{
// do allowed stuff
}
else
{
// do something for the illegal input
}
SO for exclusion I build the following pattern [^$] and pass it to ereg
above. So if the input includes a $ the ereg should return false and the
processing shouldn't take place.
Well the thing is for $pattern = '[^$]' it doesn't work. Input including
'$' is still passed to the allowed stuff code block.
So am I doing something wrong or is there a problem with the character
coding of my editor
BtW I'm using W2K with PHP 4.1.x Apache 1.3.X and TextPad 4.x for editing.
I save my scripts as ANSI format. Meaning only legal ASCII Characters +
German extended code page.
Can anybody help me?
I also tried [^a] as a pattern but the input can contain a and slip
through.