[Solved] How do I parse and split data in single quotation mark using Java?


Try using Pattern and Matcher classes from java.util.regex package. Something like this :

String data = "['first data','second data', 'third data']";
Pattern pattern = Pattern.compile("'(.*?)'");

Matcher matcher = pattern.matcher(data);

while (matcher.find()) {
    System.out.println(matcher.group(1));
}

Output:

first data
second data
third data

solved How do I parse and split data in single quotation mark using Java?