Skip to content

Commit 5ad6d6c

Browse files
kirsleNoah Petherbridge
authored andcommitted
Fix regexp escape for Python 3.6 nightly
1 parent 8a2f239 commit 5ad6d6c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rivescript/rivescript.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,9 +2292,9 @@ def _reply_regexp(self, user, regexp):
22922292
# If this optional had a star or anything in it, make it
22932293
# non-matching.
22942294
pipes = '|'.join(new)
2295-
pipes = re.sub(re.escape('(.+?)'), '(?:.+?)', pipes)
2296-
pipes = re.sub(re.escape('(\d+?)'), '(?:\d+?)', pipes)
2297-
pipes = re.sub(re.escape('([A-Za-z]+?)'), '(?:[A-Za-z]+?)', pipes)
2295+
pipes = re.sub(re.escape(r'(.+?)'), '(?:.+?)', pipes)
2296+
pipes = re.sub(re.escape(r'(\\d+?)'), '(?:\d+?)', pipes)
2297+
pipes = re.sub(re.escape(r'([A-Za-z]+?)'), '(?:[A-Za-z]+?)', pipes)
22982298

22992299
regexp = re.sub(r'\s*\[' + re.escape(match) + '\]\s*',
23002300
'(?:' + pipes + r'|(?:\\s|\\b))', regexp)

0 commit comments

Comments
 (0)