Lister: Text with backslash not found sometimes
Posted: 2022-11-26, 14:25 UTC
If you search for a text with a backslash inside, it is sometimes not found in Lister.
This happens if the character after the backslash results in a valid code, e.g. "text\something" works quite well, but "text\this" does not. That is because instead of searching for the literal text, the \t is replaced with a tab character and the search tries to find "text<tab>his" instead. (Same thing for \n,)
I couldn't find a documentation about this. I thought the codes might be the same as in C++ or Java, but it seems \r is not a valid code. I am also not sure if \n searches only for <CR><LF> (Windows default) or any combination of <CR> and <LF> or only for some of them.
The way it is now, can easily lead to mistakes. If you copy a text containing a backslash and then paste it into the search dialog, Lister may say that it doesn't exist even though it does. Unless you remember that there might be an issue with backslashes and double all of them. That is especially bothersome when you are searching for various filepaths in several logfiles.
While it is a very good idea to be able to search for special characters, I think, it should be an option you turn on explicitly like RegEx, because most of the time you are not searching for tabs or line breaks. Coloring valid codes in the search dialog might be another possibility, at least then you see immediately that there is something special in the text.
BR, WolfgangK
This happens if the character after the backslash results in a valid code, e.g. "text\something" works quite well, but "text\this" does not. That is because instead of searching for the literal text, the \t is replaced with a tab character and the search tries to find "text<tab>his" instead. (Same thing for \n,)
I couldn't find a documentation about this. I thought the codes might be the same as in C++ or Java, but it seems \r is not a valid code. I am also not sure if \n searches only for <CR><LF> (Windows default) or any combination of <CR> and <LF> or only for some of them.
The way it is now, can easily lead to mistakes. If you copy a text containing a backslash and then paste it into the search dialog, Lister may say that it doesn't exist even though it does. Unless you remember that there might be an issue with backslashes and double all of them. That is especially bothersome when you are searching for various filepaths in several logfiles.
While it is a very good idea to be able to search for special characters, I think, it should be an option you turn on explicitly like RegEx, because most of the time you are not searching for tabs or line breaks. Coloring valid codes in the search dialog might be another possibility, at least then you see immediately that there is something special in the text.
BR, WolfgangK