Brian Scott
Brian Scott

Reputation: 9361

Regex to extract csv line contents

can someone please help me out with a regex statement to achieve the following;

[Example csv line]

AAAAA,"BB B",CCCC,,"DDDD,DD DD",EEEEE

Expected matches;

AAAAA
BB B
CCCC
<empty value>
DDDD,DD DD
EEEEE

Upvotes: 0

Views: 229

Answers (1)

Jon Barker
Jon Barker

Reputation: 1828

You're best off not creating your own CSV parser, rather use a premade one such as this:

https://code.google.com/p/csharp-csv-reader/

Any reason why you wouldn't want to do this? If there's a valid one I can produce some regex, but it's not recommended as the format of the input data may change slightly and the match wouldn't happen.

Upvotes: 1

Related Questions