From 1bd8af47b0634ce952bf2a14be99e7ea807a03bb Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 26 Sep 2016 22:06:18 +0200 Subject: [PATCH] server/search: match only [a-z-]* for named tokens Adds ability to search for *:* for example. Still not perfect, but it's a start. --- server/szurubooru/search/parser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/szurubooru/search/parser.py b/server/szurubooru/search/parser.py index ab5c042f..4cde70be 100644 --- a/server/szurubooru/search/parser.py +++ b/server/szurubooru/search/parser.py @@ -92,8 +92,9 @@ class Parser(object): while chunk[0] == '-': chunk = chunk[1:] negated = not negated - if ':' in chunk and chunk[0] != ':': - key, value = chunk.split(':', 2) + match = re.match('([a-z_-]+):(.*)', chunk) + if match: + key, value = list(match.groups()) if key == 'sort': query.sort_tokens.append( _parse_sort(value, negated))