Fairly new to this world (network engineer by carrer).
I need to scrub the configuration files for some routers and need to guarantee that certain servers are configured, but no extra servers are there.
So, let's say I have three servers:
1.1.1.1, 1.1.1.2, 1.1.1.3
and the operator adds a fourth one (2.2.2.2, or any other ip address).
When scrubbing, I need to catch this fourth and signal so it can be marked for removal.
Well, I know how to match any ip address:
(25[0-5]|2[0-4][0-9]|[01]?[0-68-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
But how to select any IP address except the ones I need? I tried negative lookahead, but I either did not understand the use of it or used it wrong, because it did nothing to me.
Any hints?
I think this answer will help you solve your problem: Regex not operator You should use as many lookaheads as you have valid IP addresses.