1
匹配目前我使用下面的正則表達式匹配的URL正則表達式,而不子
/(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)[email protected])?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,63}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?/
我想知道怎樣才能將它修改爲只匹配上的域名沒有子域。
例如
http://thisiatest.com/ -> Good
thisisatest.com -> Good
http://thisiatest.com -> Good
http://thisisatest.com/folder/ -> Bad
thisisatest.com/folder/ -> Bad