how to handle repetitive regexp match checks

Jonathan Giddy J.P.Giddy at wesc.ac.uk
Fri Mar 18 08:46:29 EST 2005


GiddyJP wrote:
> 
>     # do this once
>     import Trespass
>     pattern = Trespass.Pattern()
>     pattern.addRegExp(r'struct {', 1)
>     pattern.addRegExp(r'typedef struct {', 2)
>     pattern.addRegExp(r'something else', 3)

Minor correction... in this module { always needs to be escaped if not 
indicating a bounded repeat:
      pattern.addRegExp(r'struct \{', 1)
      pattern.addRegExp(r'typedef struct \{', 2)
      pattern.addRegExp(r'something else', 3)



More information about the Python-list mailing list