I am trying to use preg_match (or ereg -- whatever works) for form field validation.
In words, I want only letters, digits, commas, periods, spaces, DASHES, and NOT anything else.
With ereg, I tried:
ereg("([a-zA-z0-9.\, -])", $field1, $arr1)
This didn't detect '[' nor ']'.
With preg_match, I tried:
preg_match("/[a-zA-z0-9.\, -]/", "$field1", $arr1)
This didn't detect '[', ']', nor ''. I haven't seen how to use '' in the same way it is defined in ereg as 'not', so I still need to find this out, also.
How to create the pattern matching statement from 'In words...' above?
I thought this would have been straight-forward.
Thank you.