I was helped on here some time ago in writing a regular expression to compare the location of the current page to that regex, and taking action if it's something specific. An example of that code is:
var re1 = new RegExp('^http://([^\.]+)\.domain\.com/subpage(.*)$');
if(window.location.href.match(re1))
{
// Do more
}
In this case, I could write some code that would only execute on that subpage. It's worked beautifully so far. But I've run into a problem where I need further assistance with regular expressions.
Imagine a site like this: http://websitenamepreview.testserver.designcompanyname.com/subpage
How can I adapt this code to work on such a URL? The only thing that will probably change, so long as it's run from this test server, is the subpage.