Is it possible to use re.compile to exclude certain numbers? For example, this will find IP addresses: ip = re.compile('\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}') But it will also find 999.999.999.999 (something which could not possibly be an IPv4 address). Can re.compile be configured to filter results like this out?