From c53bb10a71a04860758757b190620814b4993a77 Mon Sep 17 00:00:00 2001 From: Lev Velykoivanenko Date: Sun, 26 Oct 2025 17:25:42 +0100 Subject: fix(python): regex injection not working for concatenated strings (#8197) Co-authored-by: Riley Bruins --- tests/query/highlights/python/regex.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/query/highlights/python/regex.py (limited to 'tests/query/highlights/python') diff --git a/tests/query/highlights/python/regex.py b/tests/query/highlights/python/regex.py new file mode 100644 index 000000000..385ec7760 --- /dev/null +++ b/tests/query/highlights/python/regex.py @@ -0,0 +1,19 @@ +import re + +re_test = re.compile(r"^(?P\d{4}) (?P\d) \w\s{,3}$") +# ^ @string.regexp +re_test = re.compile( + # comment + # ^ @comment + r"^(?P\d{4}){1}" + # ^ @string.regexp + # comment + # ^ @comment + r"(?P\d) \w\s{,3}" + # ^ @string.regexp + # comment + # ^ @comment +) +# interpolation +print("foo %s bar %d" % ("arg1", 2)) +# ^ @character -- cgit v1.2.3-70-g09d2