Regex 在主机名之后匹配所有

Regex 在主机名之后匹配所有,regex,Regex,如何匹配主机名后面的所有内容。如果我有: http://test.someweb.net/category/subcategory/?some=value 我想匹配: /category/subcategory/?some=value 第一个匹配的组((.*))就是您需要的组 url = "http://asjahsjahsjahs.ashags.asjahs/andbcb/c/d" m = url.match(/https?:\/\/[^\/]*(\/.*)/); m[

如何匹配主机名后面的所有内容。如果我有:

    http://test.someweb.net/category/subcategory/?some=value
我想匹配:

    /category/subcategory/?some=value
第一个匹配的组(
(.*)
)就是您需要的组

url = "http://asjahsjahsjahs.ashags.asjahs/andbcb/c/d"

m = url.match(/https?:\/\/[^\/]*(\/.*)/);

m[1] ; //# =>  /andbcb/c/d 
url = "http://asjahsjahsjahs.ashags.asjahs/andbcb/c/d"

m = url.match(/https?:\/\/[^\/]*(\/.*)/);

m[1] ; //# =>  /andbcb/c/d