]> jfr.im git - erebus.git/blobdiff - modules/subtext.py
help - if nofakelag, showcommands should send the list instead of URL
[erebus.git] / modules / subtext.py
index ca0ab0475154cd32793a9487b66b29f80a77d4b3..88a2368e5747dc37f705f9938e10338f5587db86 100644 (file)
@@ -1,5 +1,7 @@
 # Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
 # module for 's/regex/replacement/' style correction
+# warning: arbitrary regex's are generally capable of various DoS attacks on CPU/memory usage. use with caution.
 # see for usage examples: https://github.com/zonidjan/erebus/commit/d7e9802778477f1faa26a03078cb1b3c018a5e5c
 # This file is released into the public domain; see http://unlicense.org/
 
@@ -21,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")