I’m posting this because I know someone out there will find it useful (or at the very least, a time saver).
What is FoxyProxy?
FoxyProxy is a great add-on to Firefox that lets you define multiple rule-based proxy servers. It lets you do things like define a rule that loads all URLs through a certain proxy server except those that match a given pattern. Rules can be wildcards (*whatever.com*) or regular expressions (https?://.*.whatever.com.*).
The problem (need an IP address regex)
I had a problem with FoxyProxy where IP addresses (e.g. 127.0.0.1, 10.0.0.1, etc) were being loaded through my work’s proxy server when they shouldn’t be using a proxy at all. This is because I had a proxy setup with a “Match all URLs” rule along with a blacklist rule for local URLs (*.myworkintranet.com*). What I needed was a blacklist rule that would tell FoxyProxy to load all IP addresses directly. Specifically, I needed a regular expression that would match any IP address.
The solution (regular expression matching any IP address)
There you have it. I know this will also match invalid IP addresses (e.g. 999.999.999.999) but it shouldn’t matter since there’s no number-only top-level domains (i.e. .999 as opposed to say, .com).
Other regular expressions you might find useful
Same thing but for FTP URLs:
Match reserved (non-Internet) IP addresses (i.e. 127.X.X.X, 10.X.X.X, 192.168.X.X, and 172.16-31.X.X):