Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityExtractFilter match multiline entity #37

Merged
merged 2 commits into from
Jun 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
* Iterates through multiple regular expression matches within a character stream.
Expand Down Expand Up @@ -119,12 +120,9 @@ private void notClosed() throws IOException {

private void readahead() throws IOException {
notClosed();
while (matches == null || !matches.hasNext()) {
String line = input.readLine();
if (line == null) {
break;
}
matches = new StringPatternMatches(line, Arrays.asList(patterns), discard);
if (matches == null || !matches.hasNext()) {
String body = input.lines().collect(Collectors.joining("\n"));
matches = new StringPatternMatches(body, Arrays.asList(patterns), discard);
}
}
}