I am taking input from a file in following format:
(int1,int2) (int3,int4)
Now I want to read int1, int2, int3 and int4 in my Java code. How ca
Pattern p = Pattern.compile("\\((\\d+),(\\d+)\\)\\s+\\((\\d+),(\\d+)\\)");
String input = "(123,456) (789,012)";
Matcher m = p.matcher(input);
if (m.matches()) {
int a = Integer.parseInt(m.group(1), 10);
int b = Integer.parseInt(m.group(2), 10);
int c = Integer.parseInt(m.group(3), 10);
int d = Integer.parseInt(m.group(4), 10);
}