I'm having trouble finding a substring within a string. The substring and the string are as follows:
var str="My name is foo.I have bag(s)"
var substr="I have bag(s)"
When I use str.match(substr), it returns null, probably because the match() function expects a regular expression input and gets confused with the '('. I tried using '\' before the round brackets, but it didn't work. The indexOf() function does work, but unfortunately, I am not allowed to use it. I also attempted using test() and exec(), but without any success.