regex - Regular expression for handling comma separated list with irregular quotes -


i receiving pretty ugly data source , need address issue regular expression. asking provider clean data source not possible. data looks this:

string 1, string 2,,"string,4",string 5

there 2 complications here, see it. need match empty string in 3rd field , need capture "string,4" 4th field. hardest part has been trying figure out how handle comma in quotes. have been playing around lookahead/lookbehind assertions haven't had luck. also, while not positive, need assume field can quoted time , expect line such 1 below , not expect consistent:

string 1, "string,2",,string 4,string 5

anyone have suggestions?

this works me. let me know if needs improved

((?:".*?")|[^,"]*) 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -