testString = \"something://something/task?type=Checkin\"; patt = new RegExp(\"something\\/(\\w*)\\?\"); match = patt.exec(testString); document.querySelector(\'#resultR
I think this would be enough: (\w*)\?, since / is not captured by \w and the only ? in the string is after your target string.
(\w*)\?