var hovertreeReg = new RegExp("^http://hovertree.com/tiku/[0-9]{1,5}.htm$");
var h_tkListUrl = "http://hovertree.com/tiku/2.htm";
var h_tkListUrl2 = "http://hewenqi.com/tiku/2.htm";
document.writeln(hovertreeReg.test(h_tkListUrl));
document.writeln(hovertreeReg.test(h_tkListUrl2));
執行效果如下:
參考:http://hovertree.com/h/bjaf/jsref_obj_regexp.htm