Answer the question
In order to leave comments, you need to log in
How to compose a regular expression checking string completely?
I need a regular expression that allows a string consisting only of letters of the English and Russian alphabet, from 2 to 25 characters long. My version: "/^[А-Яа-яA-Za-z]{2, 25}/"
As I understand it: first, the strings are characters A-Yaa-zA-Za-z in an amount from two to 25.
But if you enter a string like that, sdfsd sdfsdf
then preg_match still returns true.
How to make it so that the regular expression checks the string completely, and does not skip lines with spaces, numbers, and special characters?
Answer the question
In order to leave comments, you need to log in
what about the end of the line?
well, flags $
(modifiers) are still needed :)
, the type string sdfsd sdfsdf
will be true due to satisfaction with the regular expression. from 2 to 25 characters from the beginning of the line. sdfsd
from the beginning of the timeline has a length of 5, which fits the range of 2-25
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question