This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients William Budd, ezio.melotti, mrabarnett, serhiy.storchaka
Date 2017-06-21.06:54:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Atomic groups can help you: '<div>((?><p>.*?</p>))</div>'.

But this feature is not supported in the re module yet (see issue433030). You can use the third-party regex module which is compatible with the re module and supports atomic grouping.

>>> import regex as re
>>> pattern = re.compile('<div>((?><p>.*?</p>))</div>', flags=re.DOTALL)
>>> print(re.sub(pattern, '\\1',
...              '<div><p>foo</p>123456789</div>\n'
...              '<div><p>bar</p></div>\n'))
Date User Action Args
2017-06-21 06:54:30serhiy.storchakasetrecipients: + serhiy.storchaka, ezio.melotti, mrabarnett, William Budd
2017-06-21 06:54:30serhiy.storchakasetmessageid: <>
2017-06-21 06:54:30serhiy.storchakalinkissue30720 messages
2017-06-21 06:54:30serhiy.storchakacreate