re Challenge: More Compact?

Roy Smith roy at panix.com
Mon Jul 16 03:51:32 CEST 2001


tim at vegeta.ath.cx (Tim Hammerquist) wrote:
> from 'Mastering Regular Expressions', p.124:
> 
> '^([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])\.([01]?\d\d?|2[0-4]\d|25[0-5])$'

Along those lines, but more compact:

   r'^([01]?\d\d?|2[0-4]\d|25[0-5])(\.([01]?\d\d?|2[0-4]\d|25[0-5])){3,3}$'



More information about the Python-list mailing list