No lookbehind necessary: (^"|\\") So: match quotes, and inside them: every character except a quote ( ^" ) or an escaped quote ( ), arbitrarily many times ( ).
No lookbehind necessary: "(^"|\\")*" So: match quotes, and inside them: every character except a quote (^") or an escaped quote (\\"), arbitrarily many times (*).
3 As chaos mentioned, you probably also want to handle double-backslashes separately (although that wasn't specified by the OP). – Adam Rosenfield Aug 29 '09 at 19:08 Hah, here I go again, over-complicating the problem. Didn't think of such a simple solution at all, thanks!
– Core Xii Aug 29 '09 at 19:11 1 I'd probably use '\\. ' to allow the backslash to escape any single following character, which prevents the regex from being confused by backslash, backslash, (close) double quote. Clearly, you need a more complex expression in place of the dot if you want to handle octal or hex escapes, or Unicode escapes, or ... – Jonathan Leffler Aug 29 '09 at 21:03 I only need to escape " and \.
Thanks for your help. – Core Xii Aug 29 '09 at 23:22.
Not preceded by" translates directly to "negative lookbehind", so you'd want (?That is, a double-quote preceded by two backslashes, where in most escaping syntaxes we would be wanting to negate the special meaning of the second backslash by preceding it with the first. That sort of thing is kind of why regexes aren't a substitute for parsers.
I’m pretty sure though that a negative lookbehind is more expensive than my solution which uses a negative character class and an alternation. That’s a trivial case for regex engines. – Konrad Rudolph Aug 29 '09 at 19:04 Most likely, yeah.
– chaos Aug 29 '09 at 19:05 What about this? ^"(^"|(?Now three backslashes. :) – chaos Aug 29 '09 at 19:27 But that's already valid: "foo\\\" The first double-backslash escapes to `, leaving the \"` at the end invalid.
In the middle of the string: "foo\\\"bar" it again parses correctly, doesn't it? – Core Xii Aug 29 '09 at 20:38.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.