Does my RE rock, or suck?
Gustavo Niemeyer
niemeyer at conectiva.com
Fri Jul 9 15:41:48 EDT 2004
Hello Bryan,
> Is this likely to be fast in normal cases? Is there a
> clearly better approach?
Yes, it should be fast, since no repetitive backtracking will happen.
> What would be the worst-case time?
Given the context (person names), your worst case will probably be
failing every name.
> Am I likely to exceed recursion depth?
You won't, unless you find a name with thousands of words, and
variants for every word. With Python 2.4, you'll only get in
trouble if you exceed your system's memory.
> Any other gotcha? Am I likely to find it when I compile the
> RE, or when I try to match a path?
It looks like a sane use of regular expressions.
--
Gustavo Niemeyer
http://niemeyer.net
More information about the Python-list
mailing list