I have this regex
/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}([a-zA-Z0-9@%._~#?={}]+-*[a-zA-Z0-9@%._~#=\/;]+)+.(?!-)[a-z]{2,24}\b((?:\{[^{}]*}|[-a-zA-Z0-9@%_+.~?&#\/=:$\[\]])*)$/ Which I want to match with these urls to true since I'm getting false with my current regex:
"ftp://[email protected]:80/abc/": true "ftp://host.com": true "http://abcewe.com": true "https://abcewe.com": true "mailto:[email protected]": true "news:newsgroup-name": true "telnet://user:password@host:100": true "http://ab-c.com": true What do I need to add to match these urls? Thank you very much for the help.
Note: I need the other codes so I cant remove them.
Note: Here is the full urls that I need to match. The rest aside above is already match with this regex, the above urls isnt.
{ "http://goog": false, "http://googl": false, "http://google": false, "https://www.domains.com/#home": true, "https://www.domains.com/{firstname}_{lastname}": true, "https://www.domains.com/file[3].html": true, "https://www.domains.com/?name=fred;age=50": true, "https://www.domains.com/{name{age}}": false, "https://www.domains.com/?name=fred;": false, "http://www.google.com": true, "https://www.amazon.com": true, "http://joe:[email protected]:8080/abc/": true, "http://www.abcde.com:80/abc/": true, "ftp://[email protected]:80/abc/": true, "http://www.abcde.com/abc/": true, "http://www.abcde.com/": true, "http://joe:[email protected]": true, "http://jocce:[email protected]": true, "ftp://:[email protected]/": false, "ftp://foo:@host.com/": false, "ftp://host.com": true, "http://abcde.com": true, "https://abcde.com": true, "gopher://gopher.meulie.net/": true, "mailto:[email protected]": true, "news:newsgroup-name": true, "nntp://wild.server.example/example.group.n%2Fa/12345": true, "telnet://user:password@host:100": true, "wais://100.64.0.0:5": true, "file://vms.host.edu/disk$user/my/notes/note12345.txt": true, "prospero://host.dom//pros/name": true, "abc://a.com": false, "://abc.com": false, "http//abc.com": false, "http:abc.com": false, "HTTP://www.ABCDW.com/ABC/": true, "http://www.亜蔭.com/亜蔭/": false, "http://www.弌傲僉.com/弌傲僉": false, "http://www.俱咡.com/俱咡": false, "http://www.丂㒒儈.com/丂㒒儈": false, "http://www.亜腕弌.com/亜腕弌": false, "http://www.アバ.com/ショアバ": false, "http://www.アバショ.com/ジウンカ": false, "http://174.129.0.77": true, "http://174.1a.a.77": false, "http://174.10.23.0": false, "http://0.10.23.7": false, "http://174.10.23.+7": false, "http://-174.10.23.7": false, "http://17-4.10.23.5": false, "http://1.0.0.1": true, "http://126.255.255.254": true, "http://100.25.36.14": true, "http://128.0.0.1": true, "http://191.255.255.254": true, "http://150.25.36.14": true, "http://192.0.0.1": true, "http://223.255.255.254": true, "http://200.25.36.14": true, "http://10.0.0.0": false, "http://10.1.2.3": true, "http://10.255.255.255": true, "http://172.16.0.0": false, "http://172.0.0.5": true, "http://172.31.255.255": true, "http://192.168.0.0": false, "http://192.168.4.4": true, "http://192.168.255.255": true, "http://126.255.255.255": true, "http://127.0.36.14": true, "http://127.112.0.1": true, "http://10.190.201.10:0?port=0": false, "http://10.190.201.10:1?port=1": true, "http://10.190.201.10:21?port=21": true, "http://10.190.201.10:80?port=80": true, "https://10.190.201.10:443?port=443": true, "http://10.190.201.10:65535?port=65535": true, "http://10.190.201.10:65535?port=65536": false, "http://gooo.gl/09GxbZc": true, "www.abc.com/miss-scheme": false, "http&://10.190.201.10/wrong-scheme": false, "http://test#url/wrong-hostname": false, "http://FE80:0000:0000:0000:0202:B3FF:FE1E:8329/hostname-ipv6": false, "http://10.190.201.10:10/path/1": false, "HTTP://www.ABC①㌔№∮.com/①㌔№∮C/": false, " http://🙂 😁 😆": false, " http://zzz": false, " :// . . ": false, "https :// www. amazon. com": false, "ht tps://ww w.am azon.co m": false, "https://www.amazon.com ": false, "https:// www. amazon. com ": false, "htt ps://ww w.ama zon.c om ": false, "https ://www .amazon .com ": false, " https:// www. amazon. com": false, "http://-abc.com": false, "http://abc-.com": false, "http://ab-c.com": true, "http://.abc.com": false, "http://abc..com": false, "http://ab.c.com": true, "http://+abc.com": false, "http://ab+c.com": false, "http://abc+.com": false, "http://www.356.com": true, "http://www.35accd6.com": true, " http:/abc.com/acb": false, "http:/abc.com/acb ": false, "http:/a bc.com/a cb": false, "http://a.c": false, "http://.com": false, "http://www.com": false }
I need the other codes so I cant remove them- which codes are the other codes that you can't remove?([a-zA-Z0-9@%._~#?={}]+-*[a-zA-Z0-9@%._~#=\/;]+)+.(?!-)[a-z]{2,24}\b((?:\{[^{}]*}|[-a-zA-Z0-9@%_+.~?&#\/=:$\[\]])*)$this one