vim搜索和替换

问题描述 投票:0回答:2

我如何使用vim的搜索和替换(即:s)来替换字符串:'''($ circleSize)'''与:'''$ circleSize'''

而且我也不能只替换'''('''和''')'''或删除它们,因为它们使代码中仅有的那些以及我确实要删除的仅散布在代码中。

提前感谢!

regex vim special-characters
2个回答
0
投票

您可以尝试使用此命令替换:

:%s/<search_string>/<replace_string>/g

0
投票

类似的东西:

:%s/\v(\()(\$circleSize)(\))/\2/g

\v ............. very magic
() ............. non-scaped parenthesis represents regex groups
\2 ............. matches de second group
© www.soinside.com 2019 - 2024. All rights reserved.