]> jfr.im git - erebus.git/commitdiff
fix subtext regex
authorzonidjan <redacted>
Mon, 2 Sep 2019 05:25:15 +0000 (00:25 -0500)
committerzonidjan <redacted>
Mon, 2 Sep 2019 05:25:15 +0000 (00:25 -0500)
modules/subtext.py

index 278fe92e114597e8c4d44397d69b693b20dae8d5..894c3f847d221c5c22d3c39d8a6e062471f5c6c2 100644 (file)
@@ -23,7 +23,7 @@ modstop = lib.modstop
 # module code
 import re
 from collections import namedtuple
-re_findsub = re.compile(r"s(.)(?P<search>[^\1]+)\1(?P<replace>[^\1]+)\1(?P<global>g)?;?")
+re_findsub = re.compile(r"s(.)(?P<search>.+?)\1(?P<replace>.+?)(?:\1(?P<global>g)?|$)")
 Line = namedtuple('Line', ['sender', 'msg'])
 lastline = {}
 @lib.hooknum("PRIVMSG")
@@ -34,6 +34,7 @@ def privmsg_hook(bot, line):
        msg = pieces[3][1:]
        mo = re_findsub.match(msg)
        if mo:
+               bot.msg(chan, `mo.groups()`)
                if mo.group('global') is not None:
                        count = 0 # unlimited
                else: