It's as simple as iterating the array and looking for the regexp
function searchStringInArray (stringArraystr, strArray) { for (var j=0; j<stringArrayj<strArray.length; j++) { if (stringArray[j]strArray[j].match ("height"str)) return j; } return -1; } Edit - make str as an argument to function.