You need to change your regular expression in order to fit all the matchings that you want to retrieve, E.g.:
/((.*?),(.*?),'(.*?)','(.*?)','(.*?)'\)/g
Working Example @ regex101
You need to translate/escape the above regular expression into a Java compatible one, E.g.:
public static String REGEX_PATTERN = "\\((.*?),(.*?),'(.*?)','(.*?)','(.*?)'\\)";
Then, iterate through all the matchings trying to mimic the //g modifier, E.g.:
while (matcher.find()) {
}
Java Working Example:
package SO40002225;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static String INPUT;
public static String REGEX_PATTERN;
static {
INPUT = "(8543,0,'Washington,_D.C.','',''),(8546,0,'Extermination_camp','',''),(8543,0,'Washington,_D.C.','',''),(8546,0,'Extermination_camp','','')";
REGEX_PATTERN = "\\((.*?),(.*?),'(.*?)','(.*?)','(.*?)'\\)";
}
public static void main(String[] args) {
String text = INPUT;
Pattern pattern = Pattern.compile(REGEX_PATTERN);
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
String mg1 = matcher.group(1);
String mg2 = matcher.group(2);
String mg3 = matcher.group(3);
String mg4 = matcher.group(4);
String mg5 = matcher.group(5);
System.out.println("Matching group #1: " + mg1);
System.out.println("Matching group #2: " + mg2);
System.out.println("Matching group #3: " + mg3);
System.out.println("Matching group #4: " + mg4);
System.out.println("Matching group #5: " + mg5);
}
}
}
Update #1
Removed the escape done for commas , with-in the regular expression, as pointed by Pshemo, the , is not a meta-character or it's not being used within a limit repetition quantifier: {min, max}