I have to pass to RegExp value of variable and point a word boundary. I have a string to be checked if it contains a variable value. I don't know how to pass to regexp as a variable value and a word boundary attribute.
So something like this:
var sa="Sample";
var re=new RegExp(/\b/+sa);
alert(re.test("Sample text"));
I tried some ways to solve a problem but still can't do that :(