Shouldn't this RegExp work?

后端 未结 4 449
醉酒成梦
醉酒成梦 2021-01-27 02:37
testString = \"something://something/task?type=Checkin\";

patt = new RegExp(\"something\\/(\\w*)\\?\");
match = patt.exec(testString);
document.querySelector(\'#resultR         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-27 03:02

    I think this would be enough: (\w*)\?, since / is not captured by \w and the only ? in the string is after your target string.

提交回复
热议问题