mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-29 02:47:23 +01:00
String: Display regex error on invalid group reference (#1537)
This commit is contained in:
parent
416a05e326
commit
6021f0e6d9
@ -218,20 +218,21 @@ class String(callbacks.Plugin):
|
|||||||
s/regexp/replacement/flags, returns the result of applying such a
|
s/regexp/replacement/flags, returns the result of applying such a
|
||||||
regexp to <text>.
|
regexp to <text>.
|
||||||
"""
|
"""
|
||||||
if f('') and len(f(' ')) > len(f(''))+1: # Matches the empty string.
|
try:
|
||||||
s = _('You probably don\'t want to match the empty string.')
|
if f('') and len(f(' ')) > len(f(''))+1: # Matches the empty string.
|
||||||
irc.error(s)
|
s = _('You probably don\'t want to match the empty string.')
|
||||||
else:
|
irc.error(s)
|
||||||
t = self.registryValue('re.timeout')
|
else:
|
||||||
try:
|
t = self.registryValue('re.timeout')
|
||||||
v = process(f, text, timeout=t, pn=self.name(), cn='re')
|
try:
|
||||||
if isinstance(v, list):
|
v = process(f, text, timeout=t, pn=self.name(), cn='re')
|
||||||
v = format('%L', v)
|
if isinstance(v, list):
|
||||||
irc.reply(v)
|
v = format('%L', v)
|
||||||
except commands.ProcessTimeoutError as e:
|
irc.reply(v)
|
||||||
irc.error("ProcessTimeoutError: %s" % (e,))
|
except commands.ProcessTimeoutError as e:
|
||||||
except re.error as e:
|
irc.error("ProcessTimeoutError: %s" % (e,))
|
||||||
irc.error(e.args[0])
|
except re.error as e:
|
||||||
|
irc.error(e.args[0])
|
||||||
re = thread(wrap(re, [first('regexpMatcherMany', 'regexpReplacer'),
|
re = thread(wrap(re, [first('regexpMatcherMany', 'regexpReplacer'),
|
||||||
'text']))
|
'text']))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user