I'm trying to write a function that will delete each line that matches a pattern. But that pattern will change based on the words held in a list (made from a dictionary). I was thinking it would be a simple
for loop but the
for loop variable doesn't expand inside the pattern.
for key in sort(keys(myDict)) %g/^The key/d endfor
But the loop looks for
^The key instead of
^The blue, etc. It doesn't expand the
key variable to whatever it's holding.
How can I use a variable inside a regex pattern and have the variable expand? Or is there a better way entirely of achieving my goal?