加载中…
个人资料
luyong3435
luyong3435
  • 博客等级:
  • 博客积分:0
  • 博客访问:53,376
  • 关注人气:13
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
相关博文
推荐博文
谁看过这篇博文
加载中…
正文 字体大小:

vim贪婪匹配与非贪婪匹配

(2014-06-03 22:39:01)
标签:

vim

vim非贪婪匹配

分类: Gvim

vim中如何贪婪匹配

vim中的匹配实在是不如perl好用,一直想实现非贪婪匹配,今天偶然发现可以用量词匹配来实现,具体可以看:h /\{

\{n,m} Matches n to m of the preceding atom, as many as possible
\{n} Matches n of the preceding atom
\{n,} Matches at least n of the preceding atom, as many as possible
\{,m} Matches 0 to m of the preceding atom, as many as possible
\{} Matches 0 or more of the preceding atom, as many as possible (like *)
\{-n,m} matches n to m of the preceding atom, as few as possible
\{-n} matches n of the preceding atom
\{-n,} matches at least n of the preceding atom, as few as possible
\{-,m} matches 0 to m of the preceding atom, as few as possible
\{-} matches 0 or more of the preceding atom, as few as possible

也就是.\{-}可以实现.*的非贪婪匹配,.\{-1,}可以实现.+的非贪婪匹配。

转载自:http://www.sailingnet.net/sailingnet/3844

0

阅读 评论 收藏 转载 喜欢 打印举报/Report
  • 评论加载中,请稍候...
发评论

    发评论

    以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

      

    新浪BLOG意见反馈留言板 电话:4000520066 提示音后按1键(按当地市话标准计费) 欢迎批评指正

    新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑

    新浪公司 版权所有