Quite often I’ll create regex based filters to recognize and dispose of emails, containing origin IP addresses that are from a foreign system I’d never expect mail from. So, for example, if I’m trying to recognize an address within the range of
[CODE]185.220.0.0 – 185.255.255.255
I might compose a string like this…
[CODE]185.(?:22[0-4]|2[3-5][0-9]).
Granted I’m taking some shortcuts there.You couldn’t, for example, have a second octet be “259”. But still, if I get an origin address like “185.246.22.22”, I’d expect that string to be a match. The “185” is matched literally, the “.” is matched by the escaped “.
Now it “seems” to work, but that is an assumption based on the fact that once I get SPAM from a system, a dozen or more will usually follow. So if I install the filter and that spam source stops, its a good sign.
The trouble is, when I plug in my regex string and test IP string into the corresponding fields at regex101.com, it reports “Your regular expression does not match the subject string.” Am I doing something wrong, or am I not understanding how to use the online regex tester?