var string = \'abcd+1\'; var pattern = \'d+1\' var reg = new RegExp(pattern,\'\'); alert(string.search(reg));
I found out last night that if you tr
You probably need to escape the plus sign:
var pattern = /d\+1/
The plus sign is used in regular expressions to indicate 1 or more characters in a row.