diff --git a/plugins/Utilities.py b/plugins/Utilities.py index f0dee5a67..c35a1ad86 100644 --- a/plugins/Utilities.py +++ b/plugins/Utilities.py @@ -106,13 +106,6 @@ class Utilities(callbacks.Privmsg): (first, second) = privmsgs.getArgs(args, needed=2) irc.reply(msg, first+second) - def strsplit(self, irc, msg, args): - " Returns all matches to (in the form /regexp/flags) in text. """ (regexp, text) = privmsgs.getArgs(args, needed=2) + f = None try: r = utils.perlReToPythonRe(regexp) + f = lambda s: ' '.join(r.findall(text)) except ValueError, e: - irc.error(msg, 'Invalid regexp: %s' % e.args[0]) - return - irc.reply(msg, ' '.join(r.findall(text))) + try: + f = utils.perlReToReplacer(regexp) + substitution = True + except ValueError: + irc.error(msg, 'Invalid regexp: %s' % e.args[0]) + return + if f is None: + irc.error(msg, 'Invalid regexp: %s' % e.args[0]) + return + irc.reply(msg, f(text)) Class = Utilities