I
I
iSize1ce2015-11-15 23:03:30
PHP
iSize1ce, 2015-11-15 23:03:30

Why is the regex failing?

I have this function:

function check_fullname($name) {
  return preg_match('/^[А-Яа-яёЁ]+$/', $name);
}

I send via POST and pass through the function. Eventually:
Лещёв - не проходит
Викторович - не проходит
Павел - проходит
Апполинария - не проходит
Игоревна - не проходит
Ломаева - проходит

What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Defman21, 2015-11-15
@Pavell18RUS

Because utf-8.

function check_fullname($name) {
  return preg_match('/^[А-Яа-яёЁ]+$/u', $name);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question