Module: check_mk
Branch: master
Commit: 99bf4ce41bf09c5461ed1eee4dc523e8031fa520
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=99bf4ce41bf09c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 4 13:07:05 2014 +0100
Also validating subregexes e.g. h:... s:...
---
web/htdocs/sidebar.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 97aa15a..132e0f0 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -697,7 +697,7 @@ def parse_search_query(s):
current_string = s
for token_type, token_offset in found[-1::-1]:
found_filters.append( (types[token_type.lstrip()],
-
current_string[token_offset+len(token_type)+1:].replace("*",
".*").strip()) )
+
to_regex(current_string[token_offset+len(token_type)+1:]).strip()) )
current_string = current_string[:token_offset]
if found_filters:
@@ -712,7 +712,9 @@ def to_regex(s):
try:
re.compile(s)
except re.error:
- raise MKGeneralException(_('You search statement is not valid. You need to
provide a regular expression (regex). For example you need to e use
<tt>\\\\</tt> instead of <tt>\\</tt> if you like to search for a
single backslash.'))
+ raise MKGeneralException(_('You search statement is not valid. You need to
provide a regular '
+ 'expression (regex). For example you need to e use
<tt>\\\\</tt> instead of <tt>\\</tt> '
+ 'if you like to search for a single backslash.'))
return s
def is_ipaddress(s):