php - Using regex to filter strings by length -
php - Using regex to filter strings by length -
i trying validate input field regex pattern [a-za-z]{,10}
want find match if 10 or less chars sent in input field, problem match words less 10 chars.
is there way if there more 10 chars in input field come false, or improve strlen
php?
there of import syntax error beingness made here op , current regex answers: when using curly brace quantifier php (pcre), need specify first number. (i.e. expression: {,10}
not valid quantifier!) although comma , sec number optional, the first number in curly brace quantifier required. look should specified so:
if (preg_match('/^[a-za-z]{0,10}$/', $text)) // valid input else // invalid input
php regex
Comments
Post a Comment