Why does not it work
if(!empty($_POST['login'])) { if(preg_match('/^[А-Яа-я]+$/', $_POST['login'])) { echo '</br>' .'логин нормальный'; } else { echo '</br>' .'логин плохой'; } } Why does not it work
if(!empty($_POST['login'])) { if(preg_match('/^[А-Яа-я]+$/', $_POST['login'])) { echo '</br>' .'логин нормальный'; } else { echo '</br>' .'логин плохой'; } } If the encoding is utf-8, then you need to do this:
if(preg_match('/^[А-Яа-я]+$/u', $_POST['login'])) { Pay attention to the / u modifier. And you also need the file where this regular program is written, was also in utf-8 encoding.
About set_locale not forgotten?
Source: https://ru.stackoverflow.com/questions/57436/
All Articles