How to split a string using Pattern in Java

I want to split a string using methods in Pattern,here is what i did

String s = "[[[0.093493,51.6037],[0.091015,51.5956]]]"
Pattern branchPattern = Pattern.compile("[...]");
String[] split = branchPattern.split(s);

I want to get the result that String[] contains [0.093493,51.6037] and [0.091015,51.5956]. But the result of this code is not the result i want. How can i split this string? Or is there any way like use matcher to split this string in the format i want?

Source: regex

Leave a Reply