got a diff result from the java Pattern and Automaton
adiaixin opened this issue · 1 comments
String str = "num1=123&num2=456";
String regex = "num1=.&num2=.";
p = Pattern.compile(regex);
System.out.println(p.matcher(str).matches());
Automaton automaton = new RegExp(regex).toAutomaton();
System.out.println(automaton.run(str));
//result : true , false
if I add '\\' before '&' the result is "true, true"
is '&' a special char?
found '#' have the same problem
it also return empty when do intersection between two same regex contain the special char.
is it have other special char ?
Yes, those characters have a special meaning. See the documentation: http://www.brics.dk/automaton/doc/index.html
in particular this constructor: http://www.brics.dk/automaton/doc/dk/brics/automaton/RegExp.html#RegExp-java.lang.String-int-
and the FAQ: http://www.brics.dk/automaton/faq.html