This question already has an answer here:
I'm looking for the syntax for pattern matching or a function in PHP that returns true only if the pattern in the string occurs once. I only found the function preg_match
. But in case preg_match('/[A-Za-z]{3}/', "asdf")
it returns true
, because the given string contains the pattern. I need the logic like it works in the html input tag in the attribute pattern. More or less symbols should return false
.
</div>