From 18260e986de8c2634c7679338fb8bf2ef48d5292 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 25 Aug 2003 06:25:50 +0000 Subject: [PATCH] Removed arg, strsplit, and fixed re to handle s/// regexps too. --- plugins/Utilities.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) 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