[jsinterp] Escape regex that looks like nested set

Closes #5749
This commit is contained in:
pukkandan 2022-12-08 22:42:49 +05:30
parent 85a802969e
commit b44cd29851
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39

View file

@ -343,7 +343,8 @@ def interpret_statement(self, stmt, local_vars, allow_recursion=100):
inner, outer = self._separate(expr, expr[0], 1)
if expr[0] == '/':
flags, outer = self._regex_flags(outer)
inner = re.compile(inner[1:], flags=flags)
# Avoid https://github.com/python/cpython/issues/74534
inner = re.compile(inner[1:].replace('[[', r'[\['), flags=flags)
else:
inner = json.loads(js_to_json(f'{inner}{expr[0]}', strict=True))
if not outer: