I need to be able to find and replace sensitive data like IP addresses in log files so that I can send them to a vendor for technical support.
The trouble is that the log files also contain version numbers that look like ip addresses but with extra digits.
The regex I've got so far picks up IP addresses just fine:
(((25[0-5]){1,3}|(2[0-4]|(1\d|[1-9]|)\d)){1,3}\.?){4}
Trouble is that it also picks up things like version numbers so it also matches things like 1555.2655.3255.1594
I thought that using {1,3}
would limit it to a max of 3 digits but it isn't working like that.
I'm using Powershell to parse the files and below is a mock up of the type of formatting I'm dealing with:
test 127.1.1.1test test 10.0.0.1 test test 172.28.69.77test test 15.26.32.159 test test 15.26.32.1594test test 1.26.3255.1594test test 1555.2655.3255.1594test 255.255.255.192 256.255.255.0 999.999.999.999