Hi I'm trying to match a specific URL that allows for query strings. Basically I need the following to happen:
http://some.test.domain.com- Passhttp://some.test.domain.com/- Passhttp://some.test.domain.com/home- Passhttp://some.test.domain.com/?id=999- Passhttp://some.test.domain.com/home?id=888&rt=000- Passhttp://some.test.domain.com/other- Failhttp://some.test.domain.com/another?id=999- Fail
Here is what I have so far:
var pattern = new RegExp('^(https?:\/\/some\.test\.domain\.com(\/{0,1}|\/home{0,1}))$');
if (pattern.test(window.location.href)){
console.log('yes');
}
The above code only works for the first three and not for the query strings. Any help would be appreciated. Thanks.
/homeallowed?