Revert "SedRegex: Make pattern case-insensitive."

This reverts commit d296bbb949.
This commit is contained in:
James Lu 2020-04-02 09:47:32 -07:00
parent d296bbb949
commit 13c03716c5
2 changed files with 5 additions and 9 deletions

View File

@ -53,8 +53,7 @@ if sys.version_info[0] < 3:
'https://github.com/jlu5/SupyPlugins/tree/python2-legacy')
SED_REGEX = re.compile(r"^(?:(?P<nick>.+?)[:,] )?s(?P<delim>[^\w\s])(?P<pattern>.*?)(?P=delim)"
r"(?P<replacement>.*?)(?P=delim)(?P<flags>[a-z]*)$",
re.I)
r"(?P<replacement>.*?)(?P=delim)(?P<flags>[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()

View File

@ -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')