webrtc-ips icon indicating copy to clipboard operation
webrtc-ips copied to clipboard

RegExp for IPv6 do not work propperly

Open elvquant opened this issue 8 years ago • 2 comments

Try: var ip_regex = /([0-9]{1,3}(.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{0,4}){2,7})/

elvquant avatar May 09 '16 09:05 elvquant

Why is there a "." in the pattern? Is it really acceptable for any character to match in that case?

spemmons avatar May 09 '16 12:05 spemmons

I have only changed the 2nd part (IPv6) of the pattern. 2001::1 is valid, too.

But you are right, the "." on the IPv4 part should be masked: "." It was elliminated by the comment field here. I need to use \ to get an \ here!

elvquant avatar May 09 '16 13:05 elvquant