First time I use Regex statement.
I have java regex statement, which split String by pattern with list of some characters.
String line = "F01T8B02S00003H04Z05C0.12500";
Pattern pattern = Pattern.compile("([BCFHSTZ])");
String[] commands = pattern.split(line);
for (String command : commands) {
System.out.print(command);
}
output of above code is like (018020000304050.12500)
Actually I want output like this, ("F", "01", "T", "8", "B", "02", "S", "00003", "H", "04", "Z", "05", "C", "0.12500").
Means desired output is contains pattern character and split value both.
Can you please suggest me?