I looked around for a while, but probably I can't "Google" with the proper keywords.. so I'm here. I need to match an url stripping out protocol to first /
Target: match the first substring from http:// to first / (maybe last / don't exist) or to the end And here come a problem:
i wrote this regex
(?<=//)(.*?)(?=/)
but this regex matches only url with at least 1 '/' in the end excluding the protocol..
here some url to be matched:
- http://www.google.com/ (matched by my regex)
- http://www.google.com
- https://www.google
- xxx://www.google.com/hello/bleh blah....../
- xxx://google.com
- google.com/blah/hello.php?x=11_x.hi