Regex for finding an unterminated string

Posted by Austin Hyde on Stack Overflow See other posts from Stack Overflow or by Austin Hyde
Published on 2010-05-25T15:55:35Z Indexed on 2010/05/25 16:01 UTC
Read the original article Hit count: 409

Filed under:
|

I need to search for lines in a CSV file that end in an unterminated, double-quoted string.

For example:

1,2,a,b,"dog","rabbit

would match whereas

1,2,a,b,"dog","rabbit","cat bird"
1,2,a,b,"dog",rabbit

would not.

I have very limited experience with regular expressions, and the only thing I could think of is something like

"[^"]*$

However, that matches the last quote to the end of the line.

How would this be done?

© Stack Overflow or respective owner

Related posts about regex

Related posts about text-processing