匹配主机名后的全部
问题描述:
如何匹配主机名后的所有内容。如果我有:匹配主机名后的全部
http://test.someweb.net/category/subcategory/?some=value
我想匹配:
/category/subcategory/?some=value
答
/http:\/\/[^/]+(.*)/
的第一个匹配的组((.*)
)是一个你需要的。
答
url = "http://asjahsjahsjahs.ashags.asjahs/andbcb/c/d"
m = url.match(/https?:\/\/[^\/]*(\/.*)/);
m[1] ; //# => /andbcb/c/d