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?
I have tried your example, It will work only add .* at end of your Regx
Above line return true
http://developer.android.com/reference/java/lang/String.html#matches(java.lang.String)
Describe in above function