Examples:
http://example.com ---> http://example.com
ftp://username:password@example.com ---> ftp://username:password@example.com
http://example.com/path/to/somehwere ---> http://example.com
http://example.co.uk ---> http://example.co.uk
example.co.uk ---> example.co.uk
example.co.uk?user=John&pass=1234 ---> example.com.uk
I tried this:
.*?(:\/{2})?.*?(?=\/|$|\?)
its working for the urls without protocols but cause of the (?=\/|$|\?)
it stops at http:
Cany you help me fix my regex? or suggest better?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With