vimtricks.wiki Concise Vim tricks, one at a time.

How do you use a macro to yank all regex matches into a register?

Answer

qaq:g/pattern/normal "Ayy

Explanation

Clear register a with qaq, then use :g/pattern/normal "Ayy to append all matching lines to register a. Collects matches across the file.

Next

How do you yank a single word into a named register?