I'm using a simple regex to validate property address so that they only contain alphanumeric and underscore characters. However, when I test the script on regexlib.com it works as expected, but when I run it from my script it does not. The script I'm using takes a property address (pa) from the query string and runs it through the regex for true or false. The validation script passes true for "120_Ho_St" but false for "120_Howe_St"? In fact, any instance of "Howe" in the query string returns false. It seems simple enough but I just don't understand, if you do I would appreciate any input.
I don't see exactly what goes wrong with your regex at first sight, but I'm not comfortable with ereg(). PCRE is generally preferred (e.i. preg_functions).
GeertDD wrote:I don't see exactly what goes wrong with your regex at first sight, but I'm not comfortable with ereg(). PCRE is generally preferred (e.i. preg_functions).
The ereg family of functions are being removed in PHP 6 I believe. Besides, PCRE is more powerful than POSIX anyways.