Re: regular expressions and matches

2006-03-30 Thread johnzenger
Johhny wrote: > Hello, > > I have recently written a small function that will verify that an IP > address is valid. > > ==SNIP== > > import re > ipAddress = raw_input('IP Address : ') > > def validateIP(ipAddress): > ipRegex = > r"^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5

Re: regular expressions and matches

2006-03-30 Thread bruno at modulix
Johhny wrote: > Hello, > > I have recently written a small function that will verify that an IP > address is valid. (snip re.match() based solution - just one remark: compiling the regexp on each function call is more than useless) > I was having issues trying to get my code working so that I c

Re: regular expressions and matches

2006-03-30 Thread Fredrik Lundh
"Johhny" wrote: > I was having issues trying to get my code working so that I could pass > the IP addresses and it would return a true or false. When it matches I > get something that looks like this. > > python ip_valid.py > IP Address : 192.158.1.1 > <_sre.SRE_Match object at 0xb7de8c80> > > As

regular expressions and matches

2006-03-30 Thread Johhny
Hello, I have recently written a small function that will verify that an IP address is valid. ==SNIP== import re ipAddress = raw_input('IP Address : ') def validateIP(ipAddress): ipRegex = r"^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([