我有一个字符串,其中包含使用布尔运算符的条件,例如:
1) OR(key1:value1,key2:value2,key3:value3)
2) AND(key1:value1,key2:value2,key3:value3,key4:value4,key5:value5)
3) NOT(key1:value1,key2:value2)
4) AND(key1:value1,key2:value2,key3:value3,OR(key4:value4,key5:value5),NOT(key6:value6,key7:value7))
现在我想将其转换为另一种格式,如下所示:
1) key1='value1' OR key2='value2' OR key3='value3'
2) key1='value1' AND key2='value2' AND key3='value3' AND key4='value4' AND key5='value5'
3) NOT(key1='value1' OR key2='value2')
4) ( key1='value1' AND key2='value2' AND key3='value3' ) AND ( key4='value4' OR key5='value5') AND ( NOT(key6='value6' OR key7='value7'))
我正在浏览这个链接:想要将一种形式的字符串转换成另一种形式?
但我不清楚如何使用正则表达式来实现这一点。请让我知道如何在 Java 中执行此操作