regex - Vim Error E488: Trailing characters on substitution with gn flags -
i trying count occurrences of regex in vim following command:
:%s/class=//gn
or even:
:%s/class=/&/gn
but keep getting e488: trailing characters
. suggested in official documentation http://vimdoc.sourceforge.net/htmldoc/tips.html#count-items
can help/explain ? way have found out working :%s/class=/&/g
in opinion little overkill since substitutes regex same characters tat have been found instead of counting occurrences.
i using vim 6.3
after searching found in :help improvements-7
:
to count items (pattern matches) without changing buffer 'n' flag has been added :substitute.
thus have upgrade 7.0 @ least. :-)
Comments
Post a Comment