language: Java (sun-jdk-1.7.0_10)
date: 583 days 16 hours ago
link:
visibility: private
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import java.util.regex.*;
 
class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        String s = "a1, a2, a3, \"a4,a5\", a6";
        Pattern pattern = Pattern.compile("\\s*(\"[^\"]*\"|[^,]*)\\s*");
        Matcher matcher = pattern.matcher(s);
        while (matcher.find()) {
            System.out.println(matcher.group(1));
        }
    }
}
  • upload with new input
  • result: Success     time: 0.05s    memory: 213312 kB     returned value: 0

    a1
    
    a2
    
    a3
    
    "a4,a5"
    
    a6