Guest User

Untitled

a guest
Jul 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. $chr_en = "a-zA-Z0-9s`~!@#$%^&*()_+-={}|:;<>?,./"'\[]";
  2. if (preg_match("/^[$chr_en]+$/", $string)) {
  3. // TRUE
  4. } else {
  5. // FALSE
  6. }
  7.  
  8. $string = 'Â english'; // FALSE
  9. $string = '!english 123'; // TRUE
  10. $string = 'en + рус'; // FALSE
  11.  
  12. $chr_en = "a-zA-Z0-9s`~!@#$%^&*()_+-={}|:;<>?,./"'\[]";
  13. if (preg_match("/^[$chr_en]+$/", $string)) {
  14.  
  15. $chr_ru = "А-Яа-яЁё0-9s`~!@#$%^&*()_+-={}|:;<>?,./"'\[]";
  16. if (preg_match("/^[$chr_ru]+$/u", $string)) {
  17.  
  18. $chr_ru_en = "A-Za-zА-Яа-яЁё0-9s`~!@#$%^&*()_+-={}|:;<>?,./"'\[]";
  19. if (preg_match("/^[$chr_ru_en]+$/u", $string)) {
Add Comment
Please, Sign In to add comment