2014-03-28 160 views

回答

2
if(location.href.search(/\/personal\/[^\/]+\/default.aspx/)>-1) { 
    ... 
} 
0

試試這個:

var str = "http://random.com/personal/randonNumber/default.aspx"; 
var pattern = /personal\/.*\/default.aspx/g; 
if (str.search(pattern) != -1) { 
    console.log("Matched"); 
} 
else { 
    console.log("No match"); 
}