threading with re module

Andrew Dalke adalke at mindspring.com
Thu Jan 9 22:53:20 CET 2003


paul wrote:
  > is there any alternative to the standard re module that is
> thread-safe? i saw some discussion of pregex but it dates back to '97.
> is that still around? if not, what are people doing to get thread-safe
> regex in python?

While I can't make guarantees, I believe the re code is thread-safe.
My guess is you are reading about the old 'regex' library, which was
used before 're' and was not thread-safe.

In 1997 I believe the two libraries were 'regex' and the 3-rd
party pregex which was for POSIX regular expressions.  Since then
there was the pcre based 're' then /F's 'sre', which has supplanted
pcre as the implementation of the re module.

/F's comment at
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=AU1y4.123%24Lh9.176336384%40newsb.telia.net
implies that sre (the current sre) should be thread safe.



					Andrew
					dalke at dalkescientific.com





More information about the Python-list mailing list