Parsing Issue with Escape Characters
I have an override that inspects the message field and pulls out a filename and assigns it to deviceCustomString1.
submessage.pattern.regex = The file "([^"]+)" was accessed
My override works for most cases but breaks when the file directory string contains escape characters.
eg. msg=The file "C:\\windows\newfile" was accessed
the output in the logger would be
The file "C:\\windows
ewfile" was accessed
Where \n is treated as a new line escape character, and nothing parses properly.
Given that the [^"]+ statement does not include new line, I tried changing my regex to the following:
submessage.pattern.regex = The file "((?:\\n|[^"])+)" was accessed
This would not work. I also tried
submessage.pattern.regex = The file "((?:\n|[^"])+)" was accessed
and I also tried
submessage.pattern.regex = The file "((?:\\\n|[^"])+)" was accessed
None of these regex statements worked. Is there a simplier way to get the logger to ignore esscape characters in the message field? Perhaps a declaration of some kind at the beginning of the override?
For every "\" that you need to be escaped you need to add one more. So in your case if the regex you need to specify that you may encounter "\" and of course to be escaped (which means \\)
Differently the results may be unexpected.
A quick example in your case (C:\\windows\newfile") maybe will be: