You could start with the regular expression:
[^",]*|"[^"]*"
which matches either a non-quoted string not containing a comma or a quoted string. However, there are lots of questions, including:
Do you really have spaces after the commas in your input? Or, more generally, will you allow quotes which are not exactly at the first character of a field?
How do you put quotes around a field which includes a quote?
Depending on how you answer that question, you might end up with different regular expressions. (Indeed, the customary advice to use a CSV parsing library is not so much about handling the corner cases; it is about not having to think about them because you assume "standard CSV" handling, whatever that might be according to the author of the parsing library. CSV is a mess.)
One regular expression I've used with some success (although it is not CSV compatible) is:
(?:[^",]|"[^"]*")*
which is pretty similar to the first one, except that it allows any number of concatenated fields, so that both of the following are all recognized as a single field:
"John"", Mary"
John", "Mary
CSV standard would treat the first one as representing:
John", Mary -- internal quote
and treat the quotes in the second one as ordinary characters, resulting in two fields. So YMMV.
In any event, once you decide on an appropriate regex, the algorithm is simple. In pseudo-code since I'm far from a Java expert.
repeat:
match the regex at the current position
and append the result to the result;
if the match fails:
report error
if the match goes to the end of the string:
done
if the next character is a ',':
advance the position by one
otherwise:
report error
Depending on the regex, the two conditions under which you report an error might not be possible. Generally, the first one will trigger if the quoted field is not terminated (and you need to decide whether to allow new-lines in the quoted field -- CSV does). The second one might happen if you used the first regex I provided and then didn't immediately follow the quoted string with a comma.