testString = \"something://something/task?type=Checkin\"; patt = new RegExp(\"something\\/(\\w*)\\?\"); match = patt.exec(testString); document.querySelector(\'#resultR
You would need to escape the slash in regex literals, and the backslash in string literals which you create regexes from:
var patt = /something\/(\w*)\?/g; // or var patt = new RegExp("something/(\\w*)\\?", 'g');
I strongly recommend the first version, it is more readable.