[Python-Dev] Possible bug in re module? (original) (raw)

Dmitry Vasiliev dima at hlabs.spb.ru
Tue May 20 20:01:14 CEST 2008


I've just found a strange re behavior:

import re re.sub("(?:ab|b|a)", "+", "cbacbabcabc") 'c++c++c+c' re.sub("(?:ab|b|a){2}", "+", "cbacbabcabc") 'c+c+c+c'

In the last case |-separated expressions seems don't tried from left to right. Is it bug or just me?

-- Dmitry Vasiliev http://hlabs.spb.ru

-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: <http://mail.python.org/pipermail/python-dev/attachments/20080520/aed084ec/attachment.pgp>



More information about the Python-Dev mailing list