I got a String s = "HFGFHFFHSSH"
. What I want as output is every possible substring combination between 'H'
The output of the above String should be HFGFH HFFH HSSH
I tried the following:
String s = "HFGFHFFHSSH";
Pattern pattern = Pattern.compile("H(.*?)H");
Matcher matcher = pattern.matcher(s);
while (matcher.find()){
System.out.println(matcher.group(0));
}
Unfortunalety the output is missing one substring resulting in HFGFH HSSH