S
S
StartPy2021-10-22 19:37:32
PHP
StartPy, 2021-10-22 19:37:32

How to find an occurrence in a string of more than 4 letters?

Code

$str = "asas232%";
preg_match('/^[^a-z]*(?=[a-z])/i', $str);

we find if there are letters in the string.
I need to find if there are more than 4 consecutive letters in a string.
I tried through the length of the incoming substring, but it did not work
$s = strstr($str, '/^[^a-z]*(?=[a-z])/i');
if ($s>3){echo('Great!');}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2021-10-22
@StartPy

Well, add the number of matches to the regular season.
[a-z]{5,}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question