Possible Duplicate:
Converting ereg expressions to preg
I've tried to convert but I keep failing.
My ereg: if (!ereg("^[a-zA-Z0-9]{3,16}$",$username)) {
is wrong because it is out of date. How do I switch it to preg_match
?
Possible Duplicate:
Converting ereg expressions to preg
I've tried to convert but I keep failing.
My ereg: if (!ereg("^[a-zA-Z0-9]{3,16}$",$username)) {
is wrong because it is out of date. How do I switch it to preg_match
?
if (!preg_match("/^[a-zA-Z0-9]{3,16}$/",$username)) { /* .. */ }
Note the delimiters /
.