[Python-3000] Alternative to standard regular expressions

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Sep 29 00:55:09 CEST 2008


Giles Constant wrote:

> How about (explanation of syntax to follow):
> 
>  boolean = match(input, "oneormore(digit).one('hello')")

Take this a step further and use constructor functions
to build the RE.

   from spiffy_re import one, oneormore
   pattern = oneormore(digit) + one('hello')
   match = pattern.match(input)

-- 
Greg


More information about the Python-3000 mailing list