I have a CSV file that I'm attempting to parse using regex. The file is controlled in terms of delimiters, carriage returns, etc.
I have the following to split each row into an array of values.
/('[^']+'|[^,]+)/g
There's 2 issues with this pattern that I'm attempting to work out the kinks. The first is that it breaks commas that are used within an answer.
The second, and main issue that I'm trying to figure out is how to change this pattern to allow the null values to still be reflected in the output array.
Test Input
,,,'This is a test', 'I'm a test as well', 'I,too, am a test'
Desired Output
null
null
null
This is a test
I'm a test as well
I,too, am a test
Currently I'm getting
This is a test
I'm a test as well
I
too
am a test