A
A
Artem2016-09-14 09:13:43
PHP
Artem, 2016-09-14 09:13:43

Why does preg_match() return 0?

Hello.

if (preg_match('/^[А-ЯЁ][а-яё]*(\s[А-ЯЁ][а-яё]*)?$/', $_POST['name']) === 1) {
        $valid = true;
      }

I checked, the expression works correctly.
The input is 100% valid data. Where did I screw up?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2016-09-14
@proudmore

Exactly 0? Not false?
You can also look in the direction of Template modifiers , namely "u (PCRE_UTF8)"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question