re Challenge: More Compact?

Roman Suzi rnd at onego.ru
Sun Jul 15 21:46:48 CEST 2001


On 15 Jul 2001, Tim Daneliuk wrote:

>The following re is (I think) the description of a legitimate IP addess in
>"quad" format (IPV4).  My question is, can it be made even shorter?
>
>ipquad   = r"^((\d\d?\d?\.){3}(\d\d?\d?))$"

ipquad   = r"^((\d{1,3}\.){3}(\d{1,3}))$"

(Why not just split(it, ".") ?)

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Sunday, July 15, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "This is Borg. <ESC> is futile <CTRL> is inevitable" _/





More information about the Python-list mailing list