I have some lines of text that follow a pattern and some that don't. I'd like to copy the lines that follow this pattern and then copy/yank them into a register so that I can paste them as is someplace else.
// do something1
// do something2
// do something3
// does nothing
Now I'd basically like to select the lines that match
def.*$, copy them and paste them.
so the output would kindof look like this:
I want to know if it's possible to do this in vim.
Something like copy matched regex lines into register "m. Then I'd be able to do a "mp where ever else I need this.
I understand that something like sed, awk or grep with some redirection operators might be better suited to this task, but I'd like to know if I can use vim to do this.