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.
