Title: Nice job, thx
Name: Alessandro Di Noia
Date: 11/7/2006 5:01:53 AM
Comment:
Works great! nice job thx again
Title: New test case
Name: Daniel Einspanjer
Date: 1/25/2006 5:14:21 PM
Comment:
a,b, c, d ,
A;B; C; D ;
"e","f", "g", "h" ,
"E";" F"; "G "; " H " ;
"i,i", "j;j"; "k,k, k ,k , k"; "l;l; l ;l ; l",
"m,m,", "n,n;;"; "o\",\"o,o", "p"",""p""",
q""q, r\"r; "
s
",
"t""\",t";"u\""";u",
"v"v"v", ""w""w"";
x\"x, "y,y"; z;
"chars,trailing,after,quotes,break;the"regex
Title: Here is an updated test case for the fixed regex
Name: Daniel Einspanjer
Date: 1/25/2006 5:13:22 PM
Comment:
a,b, c, d ,
A;B; C; D ;
"e","f", "g", "h" ,
"E";" F"; "G "; " H " ;
"i,i", "j;j"; "k,k, k ,k , k"; "l;l; l ;l ; l",
"m,m,", "n,n;;"; "o\",\"o,o", "p"",""p""",
q""q, r\"r; "
s
",
"t""\",t";"u\""";u",
"v"v"v", ""w""w"";
x\"x, "y,y"; z;
"chars,trailing,after,quotes,break;the"regex
Title: Nice catch!
Name: Daniel Einspanjer
Date: 1/25/2006 5:09:03 PM
Comment:
I wish I could correct the regex but the site crashes whenever I click edit. (something went wrong with the sample matches when I was putting them in).
The fix is another whitespace capture in the negative lookahead:
\s*[;,]\s*(?!(?<=(?:^|[;,])\s*"(?:[^"]|""|\\")*[;,]\s*)(?:[^"]|""|\\")*"\s*(?:[;,]|$))
Title: Commas within the quotes
Name: Michael Ash
Date: 1/25/2006 3:53:43 PM
Comment:
If a comma inside quotes is followed by a whitespace it will match even though it shouldn't. Tested with A,b,123,"split, four"
Title: Great, the website is choking over the sample matches
Name: Daniel Einspanjer
Date: 1/25/2006 2:16:51 PM
Comment:
Here is an example of the different types of elements it can split:
a,b, c, d ,
A;B; C; D ;
"e","f", "g", "h" ,
"E";" F"; "G "; " H " ;
"i,i", "j;j"; "k,k"; "l;l",
"m,m,", "n,n;;"; "o\",\"o,o", "p"",""p""",
q""q, r\"r; "
s
",
"t""\",t";"u\""";u",
"v"v"v", ""w""w"";
x\"x, "y,y"; z;
"chars,trailing,after,quotes,break;the"regex