我有一个数据,其中有很多行,像这样:
| condition | result |
| -------- | -------- |
| ((a and b) or (c and d)) | Result A |
| (a or b or c) and ( d and e) and (x or (y and z)) | Result B |
我想把它们转换成
| condition | result |
| -------- | -------- |
| (a and b) | Result A |
| (c and d) | Result A |
| (a) and ( d and e) and (x) | Result B |
| (b) and ( d and e) and (x) | Result B |
| (c) and ( d and e) and (x) | Result B |
| (a) and ( d and e) and (y and z) | Result B |
| (b) and ( d and e) and (y and z) | Result B |
| (c) and ( d and e) and (y and z) | Result B |
所有条件都是字符串格式。例如;条件((a和b)或(c和d))在"((a和b)或(c和d))"的后面。
基本上,我希望基于"or"操作符将单个复杂条件分解为多个更简单的条件。
任何帮助都将不胜感激。
1条答案
按热度按时间ajsxfq5m1#
然后,您可以按如下方式使用此函数:
这将输出以下数组: