re.compile and very specific searches

rbt rbt at athop1.ath.vt.edu
Fri Feb 18 13:14:28 EST 2005


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?



More information about the Python-list mailing list