-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem7.java
More file actions
15 lines (13 loc) · 856 Bytes
/
Copy pathProblem7.java
File metadata and controls
15 lines (13 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Source: https://web.archive.org/web/20240117030302/https://regexone.com/problem/extracting_log_data
import java.util.regex.Pattern;
public class Problem7 {
public static void main(String[] args) {
String regex = "^.*at\\s[\\w\\.]*\\.(\\w+)\\(([a-zA-Z]+.java):(\\d+)\\)";
assert !Pattern.matches(regex, "W/dalvikvm( 1553): threadid=1: uncaught exception");
assert !Pattern.matches(regex, "E/( 1553): FATAL EXCEPTION: main");
assert !Pattern.matches(regex, "E/( 1553): java.lang.StringIndexOutOfBoundsException");
assert Pattern.matches(regex, "E/( 1553): at widget.List.makeView(ListView.java:1727)");
assert Pattern.matches(regex, "E/( 1553): at widget.List.fillDown(ListView.java:652)");
assert Pattern.matches(regex, "E/( 1553): at widget.List.fillFrom(ListView.java:709)");
}
}