I'm trying to find the regex pattern to match strings in LSF log files (lsb.acct).
Lines (log entries) in lsb.acct contain numbers and strings. Numbers are easy to match but I have a challenge with strings.
Strings are marked with surrounding "", characters " inside the string are escaped with another ".
Example:
line from lsb.acct:
0 90 "dsfc --copt ""-c"" nfc_pa" 0.01 "" -1
contains the following fields:
0 (number)
90 (number)
dsfc --copt "-c" nfc_pa (string)
0.01
(empty string)
-1 (number)
I tried /"([^"]*)"/ but it obviously doesn't solve the problem - doesn't catch the escaped double-quotes inside the string but cuts the string short.
I was thinking to add a look-ahead operator "(?=") to respect the escaped double-quote but I don't know where/how - doesn't work inside [].
Can anybody hint a proper regexp to match the string with respecting " as escape for " inside the string?