Add the ability to escape characters in filters
There are some special characters in filters:
- PIDS, tags and app names use
,
as a separator. It isn’t possible to search for tag that contains a comma. - It isn’t possible to search for pattern enclosed in
/…/
if the filter supports regexes - the pattern is always interpreted as a regex. - It isn’t obvious how to search for a numerical app name because numbers are interpreted as PIDs.
For (1) there is no workaround at all. For (2) there is a workaround - just use regex quotation: /\Q/pattern-with-slashes/\E//
For (3) there is a simple workaround - just wrap app name with regex: /1234/
, it will be interpreted as an app name.
This also interacts badly with quick filters. For (1), if the tag contains ,
then the quick filter for it can be created but not edited.
Comments (5)
-
reporter -
reporter - changed status to open
-
reporter Well, not splitting regexes at commas is backward-incompatible: imagine
/foo,bar/
. It was previously split as/foo
andbar/
but with the proposed change it won’t be split. So instead I decided to do BAT/CSV-like approach of escaping by doubling a character and drive it a little bit further:- To add comma in pattern just double it
split("foo,,bar”)
→{"foo,bar”}
- Use backticks to include surrounding whitespaces, commas, etc - only applies for plaintext:
split(` foo,bar `)
→{“ foo,bar ”)
Lots of escaping in regular expressions, though, because backticks are reserved for making pattern plaintext.
- To add comma in pattern just double it
-
reporter -
reporter - changed status to closed
- Log in to comment
One possible approach to solve (1) is to use existing
/.../
to wrap commas. I don’t particularly like this idea because lots of things have to be escaped. I incline to use a separate syntax for “verbatim strings”, e. g. use backticks for this:`verbatim, pattern`
. However, not-splitting regexes by commas is right thing to do as well. We can use usual escaping approach with prepending backslash\
to slash and backtick inside regex and verbatim string respectively.