0

For example:

sfdAAAzsd
sdfBBBadf
sd1ZZZsdf 

Hightlighted:

sfd"AAA"zsd
sdf"BBB"adf
sd1"ZZZ"sdf

all letters will be searched only

0

1 Answer 1

1

As inspired from this answer, we can search with

/\([A-Z]\)\1\{2}

Here is what the pattern after / does:

  • [A-Z] match any uppercase letter A to Z
  • \(...\) capture this (what is within \( and \)) and possibly refer to it later
  • \1 refer to the first item captured with \(...\)
  • \{2} match 2 of the preceding items (\1 in this case)

Thus the pattern above will match AAA,BBB,...,ZZZ.

To print the lines that match {pattern} we can use the :g[lobal] command, that is

:g/{pattern}/

We can omit {pattern} to use the last used search pattern, ie.

:g//

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.