Is it worth using Python's re.compile?

Posted by Mat on Stack Overflow See other posts from Stack Overflow or by Mat
Published on 2009-01-16T21:31:57Z Indexed on 2010/04/14 4:43 UTC
Read the original article Hit count: 298

Filed under:
|

Is there any benefit in using compile for regular expressions in Python?

h = re.compile('hello')
h.match('hello world')

vs

re.match('hello', 'hello world')

© Stack Overflow or respective owner

Related posts about python

Related posts about regex