equal
deleted
inserted
replaced
1 // a case of catastrophic backtracking in Java |
1 // A case of catastrophic backtracking in Java 8 |
|
2 //----------------------------------------------- |
2 // |
3 // |
3 // regexp: (a*)*b |
4 // regexp: (a*)*b |
4 // strings: aa.... |
5 // strings: aa.... |
|
6 // |
|
7 // compile: javac catastrophic.java |
|
8 // call with: java catastrophic |
|
9 // |
|
10 // IMPORTANT: |
|
11 // Java 9 improved its regex matching engine. |
|
12 // This example is now much faster. |
|
13 // |
5 |
14 |
6 import java.util.regex.*; |
15 import java.util.regex.*; |
7 |
16 |
8 public class catastrophic { |
17 public class catastrophic { |
9 public static void main(String[] args) { |
18 public static void main(String[] args) { |