goatcounter icon indicating copy to clipboard operation
goatcounter copied to clipboard

RegEx like "Filter paths" in dashboard

Open CanRau opened this issue 4 years ago • 3 comments

Would be cool to be able to for example invert a filter like !whatever

And could be useful with custom fields (https://github.com/zgoat/goatcounter/issues/191) e.g.

https://test.goatcounter.com/count?p=/hello&nojs=true

then be able to filter nojs=true and !nojs=true 😉

What do you think?

CanRau avatar Mar 04 '20 04:03 CanRau

Yeah, that might be useful, I actually thought about adding regexp support when I added the feature, but the issue here is that regexps are not very user-friendly; even for technical users it can be confusing at times.

Something like prefixing the pattern with re:: to explicitly make it a regexp might be a good option (e.g. re::^foo). Alternatively it could be a setting, but not sure I want to add too many settings to change the behaviour.

Inverting the match by starting it with a ! would probably be a good idea, regardless of regexp support.

arp242 avatar Mar 04 '20 04:03 arp242

Actually, looking at this briefly, one implementation issue is that right now paths are selected from the DB with like %filter% and then highlighted in the JS. The JS and PostgreSQL/SQLite regexp implementations probably aren't 100% compatible, so getting this to work well will be trickier than just replacing a string match with a regexp match.

arp242 avatar Mar 04 '20 04:03 arp242

I like the re::, when your going into regex why not prepend it by re:: not need for a checkbox 👍

Ooh yea that sounds iffy 😕 no pressure, I don't consider it mission critical 😉

CanRau avatar Mar 04 '20 06:03 CanRau