From 414a4a4a16a0d581bd92b9b8d5afde8d63f2355a Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 22 Dec 2016 12:12:21 -0800 Subject: [PATCH] SedRegex: require ending delimiter to prevent overzealous matching of replacement text Closes #59. --- SedRegex/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SedRegex/plugin.py b/SedRegex/plugin.py index ee8e492..cda81ad 100644 --- a/SedRegex/plugin.py +++ b/SedRegex/plugin.py @@ -49,7 +49,7 @@ except ImportError: # lower than 2.7.6: see https://stackoverflow.com/questions/3675144/regex-error-nothing-to-repeat # and https://bugs.python.org/issue18647 SED_REGEX = re.compile(r"^(?:(?P.+?)[:,] )?s(?P[^\w\s])(?P.*?)(?P=delim)" - r"(?P.*?)(?:(?P=delim)(?P[a-z]{0,3}))?$") + r"(?P.*?)(?P=delim)(?P[a-z]{0,3})?$") # Replace newlines and friends with things like literal "\n" (backslash and "n") axe_spaces = utils.str.MultipleReplacer({'\n': '\\n', '\t': '\\t', '\r': '\\r'})