This one will be short, I could be part of the previous one, but it feels like
it’s not substitution, but it’s still one. There is an n
flag which will
reports the number of matches, but does not actually substitute. It can be
useful if we want to count them.
For example :% s/it//gn
reports back:
10 matches on 6 lines
Without g
, it’s only 6 because without g
it will stop at the first match per
line:
6 matches on 6 lines