/* Separar texto por comas, excepto entre comillas, con expresiones regulares
   Con comillas escapadas
   https://es.stackoverflow.com/q/65502/127 */

import java.util.regex.Matcher;
import java.util.regex.Pattern;

class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		final String regex = ",(\"([^\\\\\"]*(?:\\\\.[^\\\\\"]*)*)\"|[^,]*)";
		final String text  = ",aaa,\"bbb\\\"bbb\",ccc,";
		
		final Pattern pattern = Pattern.compile(regex);
		final Matcher matcher = pattern.matcher("," + text);
		int n = 0;
		String elemento;
		
		System.out.println("Texto original: " + text);
		
		while (matcher.find()) {
	        System.out.print  ("Elemento " + ++n + ": ");
	        if (matcher.group(2) != null)
		    {   // Elemento entre comillas?
		        elemento = matcher.group(2); // Obtener el texto sin las comillas
		    }
		    else
		    {
		        elemento = matcher.group(1);
		    }
		    System.out.println(elemento);
		}
	}
}