PaulDotCom mailing list archives
Re: Better RegEX to find IPs
From: Adrian Crenshaw <irongeek () irongeek com>
Date: Wed, 1 Dec 2010 17:37:32 -0500
Thanks, but the one they are calling "Accurate" is the same one I'm using as best as I can tell. I don't need to split the the octets. Thanks, Adrian On Wed, Dec 1, 2010 at 5:14 PM, teacher1st <teacher1st () bellsouth net> wrote:
Some suggestions here: http://answers.oreilly.com/topic/318-how-to-match-ipv4-addresses-with-regular-expressions/ On 12/1/2010 4:08 PM, Adrian Crenshaw wrote: Hi All, I've Googled around and not had much luck finding something better. I'm trying to parse a file in Python and extract all IPs. Currently I'm using: IPsInFile = re.findall('(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',TextBlob) But this gives me some bad results such as: .106 .123.102 .128 .143 .144 .186.64 .190 .2 .200.65 .208.7 .214 .24.124.224 .250.23.32 .36.132.142 .73 0.204.35.172 0.36.132.60 0.6.1.32 0.6.1.33 0.64 1.159.84 1.33 Any ideas for a better regular expression to use? Thanks, Adrian _______________________________________________ Pauldotcom mailing listPauldotcom@mail.pauldotcom.comhttp://mail.pauldotcom.com/cgi-bin/mailman/listinfo/pauldotcom Main Web Site: http://pauldotcom.com _______________________________________________ Pauldotcom mailing list Pauldotcom () mail pauldotcom com http://mail.pauldotcom.com/cgi-bin/mailman/listinfo/pauldotcom Main Web Site: http://pauldotcom.com
_______________________________________________ Pauldotcom mailing list Pauldotcom () mail pauldotcom com http://mail.pauldotcom.com/cgi-bin/mailman/listinfo/pauldotcom Main Web Site: http://pauldotcom.com
Current thread:
- Better RegEX to find IPs Adrian Crenshaw (Dec 01)
- Re: Better RegEX to find IPs Chris Keladis (Dec 01)
- Re: Better RegEX to find IPs Adrian Crenshaw (Dec 01)
- Re: Better RegEX to find IPs teacher1st (Dec 01)
- Re: Better RegEX to find IPs Adrian Crenshaw (Dec 01)
- Re: Better RegEX to find IPs Chris Frederick (Dec 01)
- Re: Better RegEX to find IPs Pat (Dec 01)
- Re: Better RegEX to find IPs Adrian Crenshaw (Dec 01)
- Re: Better RegEX to find IPs Chris Keladis (Dec 01)