String str=",Name=Tom,Age=23,something=something,roll=1,somethng=55,"
I want to remove all those key value pairs from the string whose value is a number.
Now i am doing something like this
Pattern p = Pattern.compile(",[^=]*?=([^,]*),");
Matcher m = p.matcher(str);
String result = "";
while (m.find()) {
if (!isNumeric(m.group(1))) {
result += m.group(0);
}
}
System.out.println(result);
The expected output is
",Name=Tom,something=something,"
But now i am getting
",Name=Tom,,something=something,"
Please help.