diafygi/webrtc-ips

RegExp for IPv6 do not work propperly

elvquant opened this issue · 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})/

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

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!