How would I search an array using inArray() for a value and return true even if that value is surrounded by other characters. Here is the code I have (med is my array, it goes med[1-10]):
alprazolamlog = $.inArray('alprazolam', med) > -1;
xanaxlog = $.inArray('xanax', med) > -1;
if (alprazolamlog==true) {
$("#xanax").css("display", "block");
} else if (xanaxlog==true) {
$("#xanax").css("display", "block");
}
It returns true if the array element is "xanax" or "alprazolam". But if a user enters "xanax xr" or "alprazolam er" it will return false. Is there any way to search for string "xanax" or "alprazolam" at any point in that particular array element, even if there are other characters in that particular array element, and to return true in this case?