Regular Expressions: large amount of or's

Scott David Daniels Scott.Daniels at Acm.Org
Mon Mar 14 00:04:17 CET 2005

Daniel Yoo wrote:
> John Machin <sjmachin at> wrote:
> :"I went to alpha beta the other day to pick up some spam")
> : could use a startpos (default=0) argument for efficiently restarting
> : the search after finding the first match
> Ok, that's easy to fix.  I'll do that tonight.

I have a (very high speed) modified Aho-Corasick machine that I sell.
The calling model that I found works well is:

      def chases(self, sourcestream, ...):
           '''A generator taking a generator of source blocks,
           yielding (matches, position) pairs where position is an
           offset within the "current" block.

You might consider taking a look at providing that form.

-Scott David Daniels
Scott.Daniels at Acm.Org

More information about the Python-list mailing list