PHP: Simple regular expressions to match length?
问题 I'm creating a registration system that needs to check the name/pass etc. with REGEX (and prefer to), what I've got so far is: //Check so numbers aren't first, such as 00foobar preg_match('/^(?!\d)[a-z0-9]+$/iD',$usrname); //Just simple check preg_match('/^[a-zA-Z0-9]+$/',$psword); But I have to do stupid things in IF statements like: if strlen($psword) > 30 || if (strlen($psword) < 4) .... How would I impliment the length checking in my two original regular expression statements? This would