BUG: Regex in quicksearch not working correctly (1.6 and 2.0)

Hi all,

has it been that way all the time or does the regex-search not work correctly in the quicksearch?

So I have some servers called frparsrv01, frparsrv02, frparsrv03, …
If I search for

h:frpar

it will find the hosts. If however I search for

h:fr.*par

nothing will be found (but it should be).

We’re on 1.6.0p27. Any idea? Has it been like this all the time?

Thanks,
Kai

The problem looks like it is defaulting to “all services” if you use such a regex inside the quicksearch.
With 2.0 you have exactly the same problem / behaviour.

h: ne.*xt → leads to
image

If you use the “ne.*xt” inside the host search view you get the correct result.
Exactly the same happens for a service search inside the quicksearch field.

'*' is replaced by '.*" for simplicity, leading to the described behaviour.

We will add a note to the tooltip.
We will also fix the view that is shown if the result is empty (until now it’s always “allservices”)

Not sure I get this right: In Regexes

“*” should match zero or more characters
“+” should match one or more characters

so “.*” should be matching any characters or even no character and it’s not doing this in the quicksearch.

Or am I wrong?

I guess they are substituting * with .* Internally because not everyone is familiar with regular expression and * is a bit more common known.

2 Likes

As proposal:

Check the character before * if it’s another common regular expression character and in this case not substitute it. The outcome of abc.*xyz is different to abc..*xyz from an regular expression point. This, I think, is not intuitive at all.

I find this confusing as well. The search should use either regexp (preferred) or glob patterns, but not an arbitrary mixture of both.

3 Likes

We often use regex extensively in the search like

h:^(de|gb|fr)srvdb.*

which I think is a good feature to get all needed systems on one screen.

I understand it may be confusing to people who just want to use globbing but I think regular expressions are a pretty important feature. Making it work like 95% would be very confusing as Martin wrote.

2 Likes

also a :+1: for real regex and remove the * to .* substitution.

4 Likes