import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "([a-zA-Z]{3}[0-9,]{8,12}?)";
final String string = "AB# 33805717- 00 R/E FROM NA#52198052- 00\n"
+ "SOS 032122 TO 032122, TOTAL BILLED $2\n"
+ "OA FILMED UFE: 920220831200900\n"
+ "FILM NUMBER: VRG40947802 REC DATE: 070222\n\n"
+ "FILM NUMBER AGILE:19517960 FSRECVDATE 062722\n"
+ "DIV ATL AUDIT NUMBER 44523104\n"
+ "FILM NUMBER: ATL34910475, DDE AGILE ID: 19517960,\n"
+ "ROD NUMBER: 44523104, DIV: ATL,\n"
+ "RCVD DATE: 06/27/2022";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html