mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Changed re command to use new utils functions.
This commit is contained in:
parent
a11f302c9d
commit
aecad2fc58
@ -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)))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user