Finding mismatching quotes in a code line

Q

How to find mismatching quotes "..." in a program code line with a regular expression?

The the example program code is listed below:

✍: FYIcenter.com

A

The regular expression to find the mismatching quotes "..." in a program code can be written as: with multiple lines modifier "m" specified: Note that:

^[^"]*"               - Get the first "
([^"\n]*"[^"\n]*")*   - 0 or more pairs of "
[^"\n]*$              - No " afterward

Click the button to test this regular expression here online:

2013-02-02, 1944👍, 0💬