HomePhabricator

textlib.py: Avoid zero-width matching groups

Authored by Dalba on Apr 2 2018, 8:00 AM.

Description

textlib.py: Avoid zero-width matching groups

This is a little trick to circumvent https://bugs.python.org/issue12177 .
The Memory error of re in Python 2.7.2 and 2.7.3 has something to do with
zero-width matching groups.

Here, by using + instead of * in other_chars group we avoid a zero-width match
and to make the group optional again we make the whole positive lookahead and
its group optional.

Bug: T191161
Change-Id: Ibfc8b8f961bdb13284aa5592fd9b7597e47f9d97