[issue33658] Introduce a method to concatenate regex patterns

Serhiy Storchaka report at bugs.python.org
Mon May 28 04:16:03 EDT 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

This is not trivial task because inline flags with global scope can be occurred in any part of the pattern (although using them not at the start of the pattern is deprecated).

But starting with 3.7 you can use inline flags with local scope. This will allow you to use simple string concatenation.

pats = [r'(?m:^line.continues$)', r'(?s:begin.*?end)']

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33658>
_______________________________________


More information about the Python-bugs-list mailing list