Help create regular expressions for string checking: it should contain only Russian letters and spaces.

    3 answers 3

    If you do not let the post, do - check before sending. Regular expressions + javascript. Before you pass the values.

    • I need the regular expression! - Ilyushka Ovchinnikov
    • 3
      Here is your regular session - / [^ aa-YaA-Ya \ s] + / msi So do the if check (preg_match ('/ [^ aa YaA-Ya \ s] + / msi', $ _ POST ['name']) ) echo "not OK"; else echo "OK"; - Kenpachi
    preg_match('/[^а-яА-Я\s]+/msi',$ваша_строка); 
    • I don’t have a job $ _POST ['name'] = "Vasya Pupkin" I need in order not to let anything else in the post except the Russian letters and space - Ilyushka Ovchinnikov
     if (preg_match('/[^а-я ]+/msiu', $value)) { echo 'go away'; } else { echo 'wellcome'; } 
    • one
      describe the problem in more detail ... but nothing is clear ... - Boris Runs
    • Please try to write more detailed answers. I am sure the author of the question would be grateful for your expert commentary on the code above. - Nicolas Chabanovsky