在正則表達式中以\(
和\)
括起來的部分,在後面可以使用\1
、\2
來訪問。如將file.endswith(".h")
替換成suffix == ".h"
,可以使用命令
:1,$s/file.endswith(\(.*\))/suffix == \1/gc
正則表達式匹配特殊位置:
位置 | 符號 |
---|---|
行首 | ^ |
行尾 | $ |
單詞詞首 | \< |
單詞詞尾 | \> |
在正則表達式中以\(
和\)
括起來的部分,在後面可以使用\1
、\2
來訪問。如將file.endswith(".h")
替換成suffix == ".h"
,可以使用命令
:1,$s/file.endswith(\(.*\))/suffix == \1/gc
正則表達式匹配特殊位置:
位置 | 符號 |
---|---|
行首 | ^ |
行尾 | $ |
單詞詞首 | \< |
單詞詞尾 | \> |
https://blog.csdn.net/u013129300/article/details/129329786