开发者

Vim: Searching and Replace regex fails

开发者 https://www.devze.com 2022-12-23 08:09 出处:网络
Content: 1.Text is here. 20.More text. Why d开发者_C百科oes this Vim search and replace string fail?

Content:

1.                  Text is here.
20.                 More text.

Why d开发者_C百科oes this Vim search and replace string fail?

:%s/^\d+\.\s+/# /g


Some metacharacters need to be escaped in order to take effect:

:%s/^\d\+\.\s\+/# /g


The + must be escaped in Vim's version of regex. So use \+.

0

精彩评论

暂无评论...
验证码 换一张
取 消