O
One
Has anyone used this this DFA based package
http://www.brics.dk/~amoeller/automaton/
I have a question about it:
public class test
{
public static void main (String[] args)
{
int count = 0;
String s = "abdccabcdc";
String s2 = "ab(c|d)*";
// .brics package
dk.brics.automaton.RegExp r = new dk.brics.automaton.RegExp (s2);
dk.brics.automaton.Automaton a = r.toAutomaton();
//java regex package
java.util.regex.Matcher m =
java.util.regex.Pattern.compile(s2).matcher(s);
System.out.println("Match: " +a.run(s)); // this prints false? why?
while (m.find()) count++;
// java regex prints the right result 2
System.out.println("Match: " + " " + count);
}
}
Can anyone post an example that will get brics.automaton to print 2 in
this example, like java.util.regex does.
http://www.brics.dk/~amoeller/automaton/
I have a question about it:
public class test
{
public static void main (String[] args)
{
int count = 0;
String s = "abdccabcdc";
String s2 = "ab(c|d)*";
// .brics package
dk.brics.automaton.RegExp r = new dk.brics.automaton.RegExp (s2);
dk.brics.automaton.Automaton a = r.toAutomaton();
//java regex package
java.util.regex.Matcher m =
java.util.regex.Pattern.compile(s2).matcher(s);
System.out.println("Match: " +a.run(s)); // this prints false? why?
while (m.find()) count++;
// java regex prints the right result 2
System.out.println("Match: " + " " + count);
}
}
Can anyone post an example that will get brics.automaton to print 2 in
this example, like java.util.regex does.