I have a requirement where I want to extract the content from a file which can have multiple occurrences of the pattern. Basically files containing multiple sections and I want to extra each section. The extracted content should include the string matching the pattern
Eg: File content
01
Community based Index1-
...some text....
...some text..
Conclusion: The significant increase of testing
...
some text.
02
Community based Index2-
.some text.
.some text.
Conclusion: The significant increase of testing
...
...<End of para>
:
:
I am trying with the following pattern but it is not working
String patternStart = "\\d{2}[^\\d.,)][\\s:-]?[\\r\\n][A-Z]";
String patternEnd = "Conclusion.*(\\n.*)*"; \\ including the entire para
I am trying with pattern matcher but it is not working, I am getting no match found.
String regexString = Pattern.quote(patternStart) + "(.*?)" + Pattern.quote(patternEnd);
Pattern pattern = Pattern.compile(regexString);
while (matcher.find()) {
String textInBetween = matcher.group(1);
}