nvim-treesitter/tests/query/highlights/python/regex.py
Lev Velykoivanenko c53bb10a71
fix(python): regex injection not working for concatenated strings (#8197)
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
2025-10-26 09:25:42 -07:00

19 lines
424 B
Python

import re
re_test = re.compile(r"^(?P<year>\d{4}) (?P<day>\d) \w\s{,3}$")
# ^ @string.regexp
re_test = re.compile(
# comment
# ^ @comment
r"^(?P<year>\d{4}){1}"
# ^ @string.regexp
# comment
# ^ @comment
r"(?P<day>\d) \w\s{,3}"
# ^ @string.regexp
# comment
# ^ @comment
)
# interpolation
print("foo %s bar %d" % ("arg1", 2))
# ^ @character