I would like to be able to jump to rows that dont contain 6 quotemarks in a quoted-CSV file as it feels like a good way to identify broken rows.
I think using a regular expression with Notepad++’s find features would be a sensible approach but I’m not sure how to pick the rows up.
6 quotemarks (“) would suggest a complete row so I want to skip to any row that does not contain 6.
Here is some sample data to play with, in this example its the 4th line I’d like to jump to
"sam","mark","dave"
"sam","mark","dave"
"sam","mark","dave"
"sam","mark","
dave"
"sam","mark","dave"
"sam","mark","dave"
To find lines where quotes occur between 0 and 5 times, use this regular expression.
Explanation:
^– From the beginning of a line([^\n"]*")– Find a group containing any character except a double quote or a new line ([^"\n]), until a double quote (*").{0,5}– Find lines that contain between 0 and 5 occurrences of the group$– Until the end of the lineTo match also lines that have more than 6
"you can use this|it puts in OR the two regexes (5 or less OR 7 or more){7,}– Find lines that contain 7 or more occurrences of the group