Wiki

by yszheda

View project onGitHub

Tip 75: Use Parentheses to Capture Submatches

Return to the top: <<Practical Vim>>

regex matching duplicate words:

/\v<(\w+)\_s+\1>
  • \0 always refers to the entire match
  • \_s: matches whitespaces or a line break

References:

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h /\_
# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h 27.8