Given the following JavaScript code:
var res = 'text';
var regex = new RegExp(res);
var str = 'My text';
if (str.match(regex)) {
alert('found word');
}
I need to inform RegExp
that theres
variable can be uppercase or lowercase. Something like this: str.match (regex / i)
.