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.

4 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.

6 Likes

Hi Ronny,

can you maybe give an update if this is on some bugfix-list now?
Maybe even the improved suggestion…? :grin:

Ahem… any news here?

Sorry, i did not follow this thread because we discussed this internally and came to the conclusion as stated.
So we will not change that behaviour in the near future

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.