簡體   English   中英

無法計算Vim中的匹配數

[英]Unable to count the number of matches in Vim

你如何計算Vim中的比賽數量?

例如,對於文本

<?
:%s/<?//ng

請參閱:h count-items

計數項目描述了您的目標。

:%s/<?/whatever/ng

這是替換命令,但是n標志避免了實際的替換。

:help count-items

在VIM 6.3中,您可以這樣做:

:set report=0
:%s/<?/&/g   # returns the count without substitution

在VIM 7.2中,您可以這樣做:

:%s/<?/&/gn   # returns the count without substitution

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM