regexp cyrillic filename not matches
-
05-10-2022 - |
Вопрос
I take a list of files with php glob(."*.pdf")
.
All files have cyrillic names. For example: ООО «Рога и копыта»
Then I load the company names from the database and try to find them in the file names:
preg_match("/$firm_name/ui", $file_name, $match);
I have a problem:
for some firms even if $firm_name
visually similar to $file_name
, but preg_match says that there is no match.
mb_detect_encoding for both variables return UTF-8.
There is clearly a problem in the file name, or maybe there is a encoding or something, but I can not understand, ask your help.
UPD:
$file_name='ООО «Рога и копыта»';
preg_match("/... .Рога и копыта./ui", $file_name, $match);
As a result, I get ОО «Рога и копыта»
, one О
missing
Нет правильного решения
Не связан с StackOverflow