说,我有一个字符串:
command_a -abc -from { {A} {B} {C} {D} } -to { {A} {B} {C} {D} }
我想用一些其他字符串替换-from的花括号内的子串。所以,更换字符串后应该成为:
command_a -abc -from { <other_string> } -to { {A} {B} {C} {D} }
-from和-to可以按任何顺序排列。还有更多选项,-thru,-extra可以包含在上面的字符串中。
我想到了一个使用堆栈来解决这个问题的解决方案。想知道是否有其他解决方案。