I
I
Icqibo2019-06-25 19:41:38
PHP
Icqibo, 2019-06-25 19:41:38

How to search in Cyrillic with preg match?

Hello! This is how it works:

preg_match_all('#<div class="stats_inf">(.{1}.)</div>#is', $html1, $matches );

That's not how it is. It is necessary to include Cyrillic and the search is not carried out
preg_match_all('#<div class="stats_title">Угловые</div><div class="stats_inf">(.{1}.)</div>#is', $html1, $matches );

This is how I tried it, but it works like the first example. Ignores Cyrillic.
preg_match_all('/^([а-яА-ЯЁёa-zA-Z0-9_]+)$/u', '#<div class="stats_title">Угловые</div><div class="stats_inf">(.{1}.)</div>#is', $html1, $matches );

How can I make the regular expression not ignore the Cyrillic alphabet?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2019-06-25
@Icqibo

Good evening.
Add the "u" modifier. And it's better, as Evgeny Romashkan
wrote , not to parse html using regular ones. In general, if you can do without RV - do it. For example like this .

E
Evgeny Romashkan, 2019-06-25
@EvgeniiR

Tyk
Ps Do not parse HTML with regexp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question