Home  >  Q&A  >  body text

java - CSV data format contains delimiters within quotation marks. How to write regular expression

Recently, I encountered a CSV data separation problem in a JAVA project, which includes character types, numeric types and null values. The character type has double quotes, the numeric type does not have double quotes, and individual character fields also contain delimiters. ",".

"800802","127.0.0.1",,"caller",0.0,0,,,103,"MCX- 1:123,MCX-2:660",-1,""

How to write a regular expression to correctly separate it into

"800802"
"127.0.0.1"

"caller"
0.0
0


103
MCX-1:123,MCX-2:660
-1

I have consulted a lot of information, but I have not tried successfully. Please give me some advice, thank you!

曾经蜡笔没有小新曾经蜡笔没有小新2680 days ago897

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-27 17:43:25

    Which CSV lib should I use? Before asking a question, please explain the library you are using

    reply
    0
  • Cancelreply