import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "[0-9]";
final String string = "WEBVTT\n\n"
+ "NOTE duration:\"02:09:15.8840000\"\n\n"
+ "NOTE language:en-us\n\n"
+ "NOTE Confidence: 0.881069481372833\n\n"
+ "d8d8fcb9-ccb1-41f2-a75e-0c3088e95dc2\n"
+ "00:00:01.720 --> 00:00:07.798\n"
+ "So we're going\n"
+ "to try to\n\n"
+ "NOTE Confidence: 0.881069481372833\n\n"
+ "a8f8cc83-48c4-4acc-881b-85b37c73b42c\n"
+ "00:00:07.798 --> 00:00:13.876\n"
+ "to use Microsoft\n"
+ "Teams next week,\n\n"
+ "NOTE Confidence: 0.881069481372833\n\n"
+ "d2738b5d-b7ee-4b58-8388-4b7524c3c563\n"
+ "00:00:13.876 --> 00:00:19.954\n"
+ "so will post\n"
+ "it as a\n\n"
+ "NOTE Confidence: 0.802268326282501\n\n"
+ "baab9c8e-f018-48a2-a355-b23eb29174e9\n"
+ "00:00:19.954 --> 00:00:25.728\n"
+ "teams meeting. If you've never\n"
+ "used prosoft teams before, it's\n\n"
+ "NOTE Confidence: 0.932209372520447\n\n"
+ "73231caa-7ae7-4046-acdf-c6691c7c3c41\n"
+ "00:00:25.728 --> 00:00:30.013\n"
+ "it's. Basically the same thing,\n"
+ "just a little more stable.\n\n"
+ "NOTE Confidence: 0.825244784355164\n\n"
+ "3ab6c4cb-9d70-4140-8356-c0f7c2316874\n"
+ "00:00:30.730 --> 00:00:35.224\n"
+ "Then they will put the link in\n"
+ "Quercus and send it out as an";
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