I have made this regex to capture all types of url
(it literally capture all url
) but it also captures single ip
.
This is my scenario: I have a list full of IP, Hash and url and my url regex and ip regex both capture the same entry. I don't know if a single ip can be considered as "url".
My regex: ((http|https)://)?(www)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,9}\b([-a-zA-Z0-9()@:%_\|+.~#?&//={};,\[\]'"$\x60]*)?
Captures all these:
http://127.0.0.1/
http://127.0.0.1
https://127.0.0.1/m=weblogin/loginform238,363,771,89816356,2167
127.0.0.1:8080 ------> excluding this one is okay too (optional)
127.0.0.1 ------> i want to exclude this one
google.com
google.com:80
www.google.com
https://google.com
https://www.google.com
I want my regex to capture all url's except single ip's like this:
127.0.0.1
- Note: I want to use this in golang code (using golang regex engine)
- Note: I am using
regexp.Compile()
andFindAllString
functions.