I need to check JS matches for a dynamically generated string.
ie.
for(i=0; i< arr.length; i++)
{
pattern_1="/part of "+arr[i]+" string!/i";
if( string.search(pattern_1) != -1)
arr_num[i]++;
}
However, this code doesn't work - I presume due to the quotes. How do I do this?
Many thanks.
RegExp("string");.