threading with re module

Andrew Dalke adalke at
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
implies that sre (the current sre) should be thread safe.

					dalke at

More information about the Python-list mailing list