arp242 / goatcounter

Easy web analytics. No tracking of personal data.
https://www.goatcounter.com
Other
4.45k stars 177 forks source link

RegEx like "Filter paths" in dashboard #194

Open CanRau opened 4 years ago

CanRau commented 4 years ago

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?

arp242 commented 4 years ago

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 commented 4 years ago

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.

CanRau commented 4 years ago

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 😉