I'm using such pattern to find cyrillic symbols in my text, but it is returning true on unicode currency symbols "₴" (ukrainian hryvnya) and "€" (euro)
$pat = '/.*[А-Яа-яёЁ].*/';
$res = preg_match($pat, $str);
What is the problem?
I'm using such pattern to find cyrillic symbols in my text, but it is returning true on unicode currency symbols "₴" (ukrainian hryvnya) and "€" (euro)
$pat = '/.*[А-Яа-яёЁ].*/';
$res = preg_match($pat, $str);
What is the problem?
You should make your pattern unicode-aware with /u
modifier:
$pat = '/.*[А-Яа-яёЁ].*/u';
$res = preg_match($pat, $str);
Quoting the doc:
u (PCRE_UTF8)
This modifier turns on additional functionality of PCRE that is incompatible with Perl. Pattern and subject strings are treated as UTF-8.
Demo. BTW, if you only check whether or not cyrillic letters are present in the string without doing anything on the match (and with the given code you do), you can drop .*
parts from your pattern.