Changed re command to use new utils functions.

This commit is contained in:
Jeremy Fincher 2003-04-16 05:28:35 +00:00
parent a11f302c9d
commit aecad2fc58

View File

@ -41,6 +41,7 @@ from baseplugin import *
import re import re
import utils
import privmsgs import privmsgs
import callbacks import callbacks
@ -90,11 +91,11 @@ class Utilities(callbacks.Privmsg):
Returns all matches to <regexp> (in the form /regexp/flags) in text. Returns all matches to <regexp> (in the form /regexp/flags) in text.
""" """
(regexp, text) = privmsgs.getArgs(args, needed=2) (regexp, text) = privmsgs.getArgs(args, needed=2)
(_, regexp, flags) = regexp.split('/') try:
flag = 0 r = utils.perlReToPythonRe(regexp)
for c in flags: except ValueError, e:
flag &= getattr(re, c.upper()) irc.error(msg, 'Invalid regexp: %s' % e.args[0])
r = re.compile(regexp, flag) return
irc.reply(msg, ' '.join(r.findall(text))) irc.reply(msg, ' '.join(r.findall(text)))