PHP login regular expression

Why doesn’t it work

  if(!empty($_POST['login'])) {
     if(preg_match('/^[--]+$/', $_POST['login'])) {
  echo '</br>' .' ';
   }
   else {
  echo '</br>' .' ';
 }
}

Answer 1, authority 100%

If the encoding is utf-8 then you need to do this:

if(preg_match('/^[--]+$/u', $_POST['login'])) {

Pay attention to the /u modifier. Also, you need the file where this regular expression is written to be also encoded in utf-8


Answer 2

Did you forget about set_locale?