Parsing CSV input with a RegEx in java

后端 未结 4 2143
无人及你
无人及你 2020-11-27 16:30

I know, now I have two problems. But I\'m having fun!

I started with this advice not to try and split, but instead to match on what is an acceptable field, and expa

4条回答
  •  迷失自我
    2020-11-27 16:48

    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:

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

提交回复
热议问题