i need created java pattern to filter data, like 13.6Gb, 12MB,15.5Kb
I use those code
Pattern p = Pattern.compile("(\\d+)(\\w+)");
Matcher m = p.matcher(content);
String num_letter = m.group(1);
String union = m.group(2);
but it can’t detect decimal number, so how to modify this pattern
Try adding a conditional match for the decimal part:
Note the use of non-capturing group for the decimal part.