Remove Lines with Numbers

This regex loop will remove all lines that contain only numbers on them. There is a quirk so that it won’t work correctly on one pass, so I loop it to get it to work correctly.

; by don at htmlfixit.com
; removes all numbers on a line
; for some reason the regex doesn't
; work right, so I repeat to
; get all instances -- odd but
; sometimes it goes that way
:Loop
^!Replace "^\d+\n" >> "" ATIWRS
^!IfError END
^!Jump 1
^!GoTo Loop

Sample input:

this
that
12
567
a324
-you
15
x374

Sample output:

this
that
a324
-you
x374

Keywords: regex, regular expression, remove, numbers, line, loop, repeat

Leave a Reply

Recent Posts

Archives

Topics