Useful RE patterns (was: Variable Interpolation - status of PEP 215)

Denis S. Otkidach ods at
Thu Jun 20 13:06:34 CEST 2002

On Thu, 20 Jun 2002, Oleg Broytmann wrote:

OB> > If I were to add a dozen (or so) patterns to the (S)RE
OB> module,
OB> > what should I pick?  What patterns do you find yourself
OB> using
OB> > over and over again?
OB>    IP address (but it is required to test that every nibble
OB> is < 256)

This can be achieved in regex, try

OB>    URL
OB>    e-mail address (yes, I know very good how hard it is)
OB>    identificator (letters+digits, starting with a letter)
OB>    empty line
OB>    line consisted only with whitespaces
OB>    comment line, starting with #, may have whitespaces
OB> before #

Last three are too simple to be a pattern, IMO.

More information about the Python-list mailing list