I have been trying to split a string using regular expression in android without any success.
The string is formatted like this id;value| For example :
String valueString = "20;somevalue|4;anothervalue|10;athirdvalue|5;enoughwithvaluesalready";
I use this method to try o split the string.
public void splitString(String valueString){
Pattern p = Pattern.compile("([\\d]+);([^\\|]+)");
Matcher m = p.matcher(valueString);
boolean matches = m.matches();
}
When I run it in the Rubular-regex-editor it looks fine, in Android no matches are found. Any ideas?
([\d]+);([^\\|]+)seems fine.String.splitinstead of your own solution?