I’m not sure if you should use regular expressions in this case. This really gets complicated.
The format you are trying to parse looks a lot like CSV. There are many free libraries out there that can parse CSV files. Perhaps you should check if there is any library that fits your needs.
But you could also do the parsing yourself. This should be very easy if you read character by character. Whenever you hit a ", switch into some kind of string-literal mode. If you find a , and are not in string-literal mode, you found a new column. That’s just a simple state machine.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Comments are closed.
Get updates from OCPSoft
If you find our tools useful, please consider making a donation to help us stay online and building software!