Hi
I'm not a fan of RegEx because I'm useless with it.
I am validating form fields. The first challenge that involves RegEx is to check that the "name" field contains only letters and optional spaces.
e.g. valid values:
John
John Smith
John David Smith
e.g. invalid value:
123
Johnny 5
John Smith 3rd
Here's my attempt at Regex, where $value is the raw POSTed field data:
if (preg_match("/[[a-zA-Z]*[ \t]*]*/",$value)) {
$valid = True;
} else {
$valid = False;
}
I believe that RegEx says I want any number of alphas in upper or lower case, followed by any number of spaces......and that pattern can repeat any number of times.
However, this is allowing numbers through.