You beat me to it! While digesting rice pudding I realised you could avoid the loop similarly, so here's the "Regex Replace" version of the same, skipping the need for capture groups:
REMOVE Top Line(s) w Variable.kmmacros (16.0 KB)
@noisneil -- you can probably do similar in the other subs that take a variable line number.
Maybe pop a "Custom HTML Prompt" instead?