From 04b101c556bb85cb454c8e8fb5b4cdc400dacf95 Mon Sep 17 00:00:00 2001 From: vitaliys Date: Mon, 15 Sep 2014 17:36:35 +0300 Subject: [PATCH] upd: sokr.py --- plugins/sokr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/sokr.py b/plugins/sokr.py index c90dba7..6bc45e7 100644 --- a/plugins/sokr.py +++ b/plugins/sokr.py @@ -26,7 +26,11 @@ def sokr(type, jid, nick, text): text = text.strip() if not text: msg = L('What?','%s/%s'%(jid,nick)) else: - if re.search('\A\d+?(-\d+?)? ', text): target, text = text.split(' ', 1) + tmp_target = re.search('(\A| )\d+?(-\d+?)?(\Z| )', text) + if tmp_target: + target = tmp_target.group().strip() + text = text.replace(target, ' ') + text = reduce_spaces_all(text) if re.match('[a-zA-Z]+\Z', text): data = load_page('http://www.abbreviations.com/%s' % text) results = re.findall('

(.+?)

', data)