Posted By

pictonio on 05/05/11


Tagged

php strings


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

pictonio


validate non-english characters in a string


 / Published in: PHP
 

  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  

You need to login to post a comment.