Saving results of Regex Search into a file with Vim

file-manipulation, regex, vim

Solution

Put your cursor in the first row/column and try this:

:redir > output.txt|while search('href="', "We")|exe 'normal yi"'|echo @"|endwhile|redir END

Problem

I've got a HTML file, and I'd like to grab all the links that are in the file and save it into another file using Vim. I know that the regex would be something like: ``` :g/href="\v([a-z_/]+)"/ ``` but I don't know where to go from here.

Original source