开发者

Match all after hostname

开发者 https://www.devze.com 2023-04-01 12:29 出处:网络
How can I match all that comes after a hostname. If I have: http://test.someweb.net/category/subcategory/?some开发者_JAVA技巧=value

How can I match all that comes after a hostname. If I have:

    http://test.someweb.net/category/subcategory/?some开发者_JAVA技巧=value

I want to match:

    /category/subcategory/?some=value


/http:\/\/[^/]+(.*)/

The first matched group ((.*)) is the one you need.


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

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

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号