I’m trying to see if a string is an IP address. Since IPv6 is rolling out it’s better to support that too, so to make it simple, i just want to replace anything that isn’t a dot or a number.
I found this regex on stackoverflow by searching:
\d+(?:\.\d+)+
but it does the opposite of what i want. Is it possible to inverse that regex pattern?
Thanks!
Try the following:
Matches anything that is not a dot or a number