a simple regex question
Posted: Sun Sep 02, 2007 8:56 am
Hi all,
Could you help me out here plz?
I want to validate a username with regular expressions, where username can begin with letters or numbers, and it may follow with the only underscore(_) and/or the only dot(.). Finally username should end with letters or numbers.
Ex:
Valid user names:
hello_world
HELLO.World
hello.beautiful_world
Invalid usernames:
hello__world
HELLO..World
hello._beautiful_.world
btw, underscore and dot orders are not important. What i mean is, first may come an underscore, then a dot. Or the other way around.
Could you write the code with preg_match, plz?
Thank you.
Could you help me out here plz?
I want to validate a username with regular expressions, where username can begin with letters or numbers, and it may follow with the only underscore(_) and/or the only dot(.). Finally username should end with letters or numbers.
Ex:
Valid user names:
hello_world
HELLO.World
hello.beautiful_world
Invalid usernames:
hello__world
HELLO..World
hello._beautiful_.world
btw, underscore and dot orders are not important. What i mean is, first may come an underscore, then a dot. Or the other way around.
Could you write the code with preg_match, plz?
Thank you.