From 45d30d4e13f5b2378c64723ee4b3cadb5828b599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 5 Jun 2012 12:57:06 +0200 Subject: [PATCH] take numbers wherever they are --- tabellio/searchform/cmpfunctions.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tabellio/searchform/cmpfunctions.py b/tabellio/searchform/cmpfunctions.py index 2f3c77a..deca707 100644 --- a/tabellio/searchform/cmpfunctions.py +++ b/tabellio/searchform/cmpfunctions.py @@ -6,15 +6,15 @@ import tabellio.config.utils def get_no_as_int(i): if i: - if ' ' in i: - try: - return int(re.match('\d+', i.strip()).group()) - except (ValueError, AttributeError): - return 99999 try: return int(i.split('-')[0]) except ValueError: - return 99999 + pass + try: + return re.findall('\d+', i)[0] + except IndexError: + pass + return 99999 return 0 class Cmp: