Hi all,
I've been out of PHP for a little while, so getting back to using regular expressions is starting to confuse a little... again :p
Basically I am creating a rule which will needs to do the following:
- must contain at least a letter [A-Za-z]
- could contain a number [0-9] (optional)
- could contain whitespace [\n] (optional)
$var = "Freddy123";
ereg("\s*[A-Za-z]", $var);
this is what Ive managed to produce so far, but I cant seem to figuring out to include the optional numerics part -> [0-9] - would I need to put a * infront of them too since its optional that they would be there?
A rule like this -> [0-9A-Za-z] meets most of my needs but I do need it to allow whitespace also (space) ... Im not sure how to enter that into the above rule so could anyone please provide me with some hints?
Thanks