lex and csv file parsing
Posted on 2004-11-22
I'm trying to parse a comma separated value file with lex, and came upon some difficulties:
if i have 4 fields per line (field1, field2, field3, field4),
using this pattern, will only grab up to field3:
that means, when I want to print out the entire line (after making sure that line contains a valid value in say field3, I then can't get access to field4....cuz the above reg expr seems to act like a tokenizer, it'll only recognize fields "before" the comma. So in this case, field4, which has no comma after it, doesn't fall into the match range...
any suggestions on how I could also grab field four and print out the entire line?