Skip to content

Instantly share code, notes, and snippets.

@alash3al
Last active March 8, 2017 14:08
Show Gist options
  • Save alash3al/7408cbf3df69b2f6d7a7 to your computer and use it in GitHub Desktop.
Save alash3al/7408cbf3df69b2f6d7a7 to your computer and use it in GitHub Desktop.
has_ar(), check if string contains arabic char(s)
/**
* Check if string has an arabic char
* @author Mohammed Alashaal <fb.com/alash3al>
* @param element str
* @return bool
*/
function has_ar(str)
{
var x = /[\u0600-\u06FF]+/;
return x.test(str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment