I have a problem using Z3 Java-API to compare the String with the regular expression.
For some target regular expressions:
"^[a-zA-Z]"
When I try to match the Strings with the regular expressions, it is still recognized as a string. For example:
SeqExpr c1 = ctx.mkString("^[a-zA-Z]");
ReExpr c2 = ctx.mkToRe(ctx.mkString("abc"));
s.add(ctx.mkInRe(c1, c2));
s.check();
System.out.println("c1 = " + c1);
System.out.println("mkInRe = " + ctx.mkInRe(c1, c2));
System.out.println(s.check());
The result is:
c1 = "^[a-zA-Z]"
mkInRe = (str.in.re "^[a-zA-Z]" (str.to.re "abc"))
UNSATISFIABLE
The "^[a-zA-Z]" whole part is recognized as a string but not a regular expression.
And I found that Defining constraints in Z3 using Boolean operators, this question would be highly related, Can something similar about the regular expression be done in Z3 Java?
Thanks!