Here is my code:
function isValid($string) {
return strlen($string) >= 6 &&
strlen($string) <= 40 &&
preg_match("/\d/", $string) &&
preg_match("/[a-zA-Z]/", $string);
}
// Negative test cases
assert(!isValid("hello"));
// Positive test cases
assert(isValid("abcde2"));
As you see, my script validates a string based on 4 conditions. Now I'm trying to develop this one:
preg_match("/[a-zA-Z]/", $string)
This condition returns true
just for English letters. How can I also add other letters like ا ب ث چ
. Well how can I do that?
Note: Those characters aren't Arabic, they are Persian.