Regex Intersection problem
adiaixin opened this issue · 1 comments
String url = "https://a.b.com/d.html?p=ttt";
String regex1 = "(http|https)://a\\.b\\.com.*";
String regex2 = "^(http|https)://a\\.b\\.com/d\\.html.*";
Automaton automaton = new RegExp(regex1).toAutomaton();
Automaton match = new RegExp(regex2).toAutomaton();
System.out.println(Pattern.compile(regex1).matcher(url).matches()); //true
System.out.println(Pattern.compile(regex2).matcher(url).matches()); //true
System.out.println(automaton.intersection(match).isEmpty()); //true
hi, I have two regex regex1,regex2.
Java Pattern matches the same url.
But the Automaton intersection is empty.
It return not empty only the two regex both haven't '^' or both start with '^'.
How can I get not empty no matter have or not '^'
Thx.
Please see the first item in the FAQ: http://www.brics.dk/automaton/faq.html
See also http://www.brics.dk/automaton/doc/index.html?dk/brics/automaton/RegExp.html