我有一个字符串,它的值如下
{ctrl1} + {ctrl2}
({ctrl1} / {ctrl2}) * {ctrl3}
if ({ctrl1} > {ctrl2}) then {ctrl1} * 10 else {ctrl} + {ctrl2} endif
可能有几个这样的公式。这将在字符串变量中可用。我需要提取所有{..}
值。
因此,在示例 1 中,我应该提取{ctrl1}
, {ctrl2}
。在 Example2 中,我应该提取{ctrl1}
, {ctrl2}
, {ctrl3}
. 在示例 3 中,我应该提取{ctrl1}
, {ctrl2}
。
有人可以帮我用正则表达式吗?