KS2011: Structured error logging
KS2011: Structured error logging
Posted Oct 25, 2011 8:21 UTC (Tue) by l0b0 (guest, #80670)In reply to: KS2011: Structured error logging by liljencrantz
Parent article: KS2011: Structured error logging
You also need to account for the fact that you might have an even or odd number of backslashes before the quote:
To fix it, we would need to check that any quotes are preceded by an *odd* number of backslashes:
echo '"foo \"bar\" baz"' | grep -E '"([^"]|\\.)*"' # Succeeds
echo '"foo \"bar\\" baz"' | grep -E '"([^"]|\\.)*"' # Ouch, that's a literal backslash, not an escaped quote!
Unfortunately this doesn't work with "([^"]|(?<=\\(\\\\)*)")*"
grep -P
("lookbehind assertion is not fixed length"). I don't know if any other regex engines support this.
Posted Oct 25, 2011 8:53 UTC (Tue)
by iq-0 (subscriber, #36655)
[Link] (2 responses)
Posted Oct 25, 2011 9:35 UTC (Tue)
by liljencrantz (guest, #28458)
[Link] (1 responses)
Posted Oct 25, 2011 10:02 UTC (Tue)
by nix (subscriber, #2304)
[Link]
KS2011: Structured error logging
KS2011: Structured error logging
KS2011: Structured error logging