[issue46825] slow matching on regular expression

2022-02-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The re module does not support features corresponding to std::regex_constants::__polynomial in C++. Rewrite your regular expression or try to use alternative regex implementations (for example wrappers around the re2 library or C++ regex library).

[issue46825] slow matching on regular expression

2022-02-22 Thread Matthew Barnett
Matthew Barnett added the comment: The expression is a repeated alternative where the first alternative is a repeat. Repeated repeats can result in a lot of attempts and backtracking and should be avoided. Try this instead: (0|1(01*0)*1)+ --

[issue46825] slow matching on regular expression

2022-02-22 Thread Heran Yang
New submission from Heran Yang : I'm using `re.fullmatch` to match a string that only contains 0 and 1. The regular expression is: (0+|1(01*0)*1)+ It runs rather slow with Python 3.7, but when I try using regex in C++, with std::regex_constants::__polynomial, it works well. Would someone