I have regex for detecting Cyrillic First, Middle and Last names.
([А-Я][а-я]+\s+[А-Я][а-я]+[.|\s|][А-Я][а-я]+[.|\s|])
Using:
preg_match_all('/([А-Я][а-я]+(\\s|.|[ ])[А-Я][а-я]+(\\s|.|[ ])[А-Я][а-я]+)/','it\'s a test string with a name like Васильців Василь Васильович and Петро Петрович Петренко смисми ВВ Аммм Мммм Аааааа',$ar);
The results:
Array
(
[0] => Array
(
[0] => �асил�
[1] => �асил�
[2] => �асильови�
[3] => енко
[4] => мисми
[5] => �ааааа
)
[1] => Array
(
[0] => �асил�
[1] => �асил�
[2] => �асильови�
[3] => енко
[4] => мисми
[5] => �ааааа
)
[2] => Array
(
[0] => �
[1] => �
[2] => �
[3] => �
[4] => �
[5] => �
)
[3] => Array
(
[0] => �
[1] => �
[2] => �
[3] => �
[4] => �
[5] => �
)
)
It's working fine at https://regex101.com/r/xA6vX0/1 but does not work in PHP (it's detecting wrong text parts). Can you explain what's wrong or prompt me to a better online service?
uhelps:'/([А-Я][а-я]+(\\s|.|[ ])[А-Я][а-я]+(\\s|.|[ ])[А-Я][а-я]+)/u'