I have a form in which a user submits a field. A field can have letters, numbers, and punctuation. But I want to check that at least 3 characters are letters. How can I specify a regex?
For instance,
$string = "ab'c";
And I need something like
if (preg_match("/[a-z]{3}/i", $string))
print "true";
else
print "false";
This line has three letters, although it has an apostrophe. That must be true. But for some reason this is checking the lie right now.
Any help?
source
share