I'm trying to fix this regex, it's meant to match any string of characters except unescaped quotation marks and unescaped newline characters:
([^"]|\\"|[^\n]|\\n)*
Would anyone mind helping out?
For example I would want to match:
The cow jumped over the \\"moon
but not:
The cow jumped over the "moon
Same for newlines
You may use this regex:
RegEx Demo
RegEx Details:
^: Start[^"\n\\]*: Match 0 or more of any char except newline. backslash and"(: Start 2nd group\\: Match literal backslash.: Match any character following a\[^"\n\\]*: Match 0 or more of any char except newline. backslash and")*: End 2nd group. Match 0 or more of this group$: End