Y
Y
Yarik2020-07-17 18:13:38
PHP
Yarik, 2020-07-17 18:13:38

Problem with regex?

Can you please explain what is the problem?
I have a regular expression that returns 0

preg_match('/^[a-zA-Zа-яА-ЯёЁІіЇїЄєҐґ\']+$/', 'пример'));

and 1
preg_match('/^[a-zA-Zа-яА-ЯёЁІіЇїЄєҐґ\']+$/', 'example')


Why is there 0 in the first option?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
v3shin, 2020-07-17
@Yariik

You forgot the u flag : you have a string in utf-8.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question