Parsing CSV input with a RegEx in java

Operator precedence. Basically there is none. It’s all left to right. So the or (|) is applying to the closing quote lookahead and the comma lookahead

Try:

(?:(?<=")([^"]*)(?="))|(?<=,|^)([^,]*)(?=,|$)

Leave a Comment