How to allow only Russian letters to be entered regularly? I tried it, it does not work /[а-я]/

  • Try /[А-Яа-я]+/ - Let's say Pie

1 answer 1

 $text = 'Текст'; if (preg_match('/^[а-я]+$/iu', $text)) { echo 'Правильно'; } else { echo 'Неправильно'; } 
  • It works) Thank you) and how to prohibit also the input of spaces? - Christine
  • @Christina spaces in my example are prohibited. Only Russian letters - Manitikyl
  • one
    @Manitikyl why do you have the s modifier? - Edward
  • @ Edward cleaned up. - Manitikyl