re Challenge: More Compact?

Roy Smith roy at panix.com
Sun Jul 15 21:51:32 EDT 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