如何将两个正则表达式与 Python Z3 绑定连接起来?

How do I concatenate two regexes with the Python Z3 bindings?

我从 看到 SMTLIB 绑定中有一个 re.++ 函数似乎可以满足我的要求。它在 Python 绑定中的等价物是什么?例如:

from z3 import *
r1 = Star(Re('ab'))
r2 = Re('a')
r_concatenated = Re(r1 ++ r2)

相当于正则表达式 ab*a。我如何获得 r_concatenated

我在发布这个问题后大约一分钟找到了答案。如果您使用 Concat 方法,它会起作用,尽管文档只提到了位向量。所以代码将是:

from z3 import *
r1 = Star(Re('ab'))
r2 = Re('a')
r_concatenated = Concat(r1, r2)