validate non-english characters in a string


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /**
  2.   * A function used to validate non-english characters in a string using regex
  3.   */
  4. function validate_non_english_characters($string) {
  5. $string = strtolower($string);
  6.  
  7. if (!preg_match('/^[a-z0-9]{3,15}$/', $string)) {
  8. // do something
  9. }
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.