I have a search box in my jsp page . When the user types something in the search box a suggest list is displayed.
I have something like the below code which generates the suggest list dynamically
sampleQuery.replace(new RegExp("("+query+")","ig"),'Foo'); ...(1)
Now the query object is the string which the user types in the search box. When I typoe in something like "?Foo" in firebug it gives javascript error on line 1. I suspect "?" is part of regular expression that's why it's throwing error.
How I can resolve the problem?