From 13c03716c506a53248d427189b51311d42387d8f Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 2 Apr 2020 09:47:32 -0700 Subject: [PATCH] Revert "SedRegex: Make pattern case-insensitive." This reverts commit d296bbb949540df1a9e5dd1b01374e94245f7f34. --- plugins/SedRegex/plugin.py | 8 +++++--- plugins/SedRegex/test.py | 6 ------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/SedRegex/plugin.py b/plugins/SedRegex/plugin.py index 61c8a712f..233429b17 100644 --- a/plugins/SedRegex/plugin.py +++ b/plugins/SedRegex/plugin.py @@ -53,8 +53,7 @@ if sys.version_info[0] < 3: 'https://github.com/jlu5/SupyPlugins/tree/python2-legacy') SED_REGEX = re.compile(r"^(?:(?P.+?)[:,] )?s(?P[^\w\s])(?P.*?)(?P=delim)" - r"(?P.*?)(?P=delim)(?P[a-z]*)$", - re.I) + r"(?P.*?)(?P=delim)(?P[a-z]*)$") # Replace newlines and friends with things like literal "\n" (backslash and "n") axe_spaces = utils.str.MultipleReplacer({'\n': '\\n', '\t': '\\t', '\r': '\\r'}) @@ -86,12 +85,15 @@ class SedRegex(callbacks.PluginRegexp): match = SED_REGEX.search(escaped_expr) + if not match: + return + groups = match.groupdict() pattern = groups['pattern'].replace('\0', delim) replacement = groups['replacement'].replace('\0', delim) if groups['flags']: - raw_flags = set(groups['flags'].lower()) + raw_flags = set(groups['flags']) else: raw_flags = set() diff --git a/plugins/SedRegex/test.py b/plugins/SedRegex/test.py index 7ee842138..50a045ca5 100644 --- a/plugins/SedRegex/test.py +++ b/plugins/SedRegex/test.py @@ -51,12 +51,6 @@ class SedRegexTestCase(ChannelPluginTestCase): m = self.getMsg(' ') self.assertIn('Abcd testefgh', str(m)) - def testCaseInsensitiveRegexp(self): - self.feedMsg('aliens are invading, help!') - self.feedMsg('S/a/e/i') - m = self.getMsg(' ') - self.assertIn('eliens', str(m)) - def testCaseInsensitiveReplace(self): self.feedMsg('Aliens Are Invading, Help!') self.feedMsg('s/a/e/i')