Does anyone know how to write regex pattern, that does this:
let's say I have letters in array like
$letters = array('a','b','a');
and also we have a word Alabama and I want preg_match to return true, since it contains letter A two times and B. But it should return false on word Ab, because there aren't two A in that word.
Any ideas ?
EDIT: the only pattern I tried was [a,b,a] but it returns true on every word that does contain one of these letters and also doesn't check it for multiple letter occurences
we have a word Alabama?try with^aba\z/gmif aba is fixed it will work. - Chonchol Mahmud