G
GIMME
I can't figure an expression needed to parse a string.
This problem arrises from parsing Excel csv files ...
The expression must parse a string based upon comma delimiters,
but if a comma appears in double quotes it should not be used for parsing.
For example in the simple case we'd have :
$a='hello,brave,world';
($v,$x,$y) = split(/,/,$a);
Should yeild (no suprise here)
hello for $v
brave for $x, and
world for $y
For the more advanced case we'd have :
$a='hello,"brave, but cruel, and joyous","planet, or world"';
hello for $v
brave, but cruel, and joyous for $x, and
planet, or world for $y
Thanks in advance to the kind souls who are sharp enough to get this one.
This problem arrises from parsing Excel csv files ...
The expression must parse a string based upon comma delimiters,
but if a comma appears in double quotes it should not be used for parsing.
For example in the simple case we'd have :
$a='hello,brave,world';
($v,$x,$y) = split(/,/,$a);
Should yeild (no suprise here)
hello for $v
brave for $x, and
world for $y
For the more advanced case we'd have :
$a='hello,"brave, but cruel, and joyous","planet, or world"';
hello for $v
brave, but cruel, and joyous for $x, and
planet, or world for $y
Thanks in advance to the kind souls who are sharp enough to get this one.