我有一个看起来像这样的网址
https://test.high.com/people/11111111-name-firstname-_custa/deals/new
现在我需要匹配document.URL
如果即时通讯在该页面上,如果是的话,我会提醒您一条消息。
重要的部分是/ deals / new
如何在Javascript中将其匹配?
最佳答案
var regex = new RegExp("/deals/new$");
if(document.URL.match(regex))
alert("yeah");