[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    re question
From:       "Dan Bar Dov" <bardov () gmail ! com>
Date:       2007-09-19 12:17:16
Message-ID: d6944c490709190517t390086d4m915b77b1cef5055a () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I'm trying to construct a regular expression to match valid IP address,
without leading zeroes (i.e
1.2.3.4, 254.10.0.0, but not 324.1.1.1, nor 010.10.10.1)

This is what I come up with, and it does not work.

r'(^[12]?\d{0,2}\.){3,3}[12]?\d{0,2}'

What am I doing wrong?
Any common knowledge IP matching RE?

Thanks,
Dan

[Attachment #5 (text/html)]

I&#39;m trying to construct a regular expression to match valid IP address, without \
leading zeroes (i.e<br><a href="http://1.2.3.4">1.2.3.4</a>, <a \
href="http://254.10.0.0">254.10.0.0</a>, but not 324.1.1.1, nor <a \
href="http://010.10.10.1"> 010.10.10.1</a>)<br><br>This is what I come up with, and \
it does not work.<br><br>r&#39;(^[12]?\d{0,2}\.){3,3}[12]?\d{0,2}&#39;<br><br>What am \
I doing wrong? <br>Any common knowledge IP matching RE?<br><br>Thanks,<br>Dan<br>



-- 
http://mail.python.org/mailman/listinfo/python-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic