Re: Need help on Regex

Splash Forums PrettyFaces Users Need help on Regex Re: Need help on Regex


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. :)