How to remove lines that do not contain ONLY alphanumeric characters.
Nicholas Wetzel last edited by
I want to remove all the lines from my txt if the line does not have ONLY alphanumeric characters.
This means if there is one or more non alpha-numeric characters in a line, I want to remove the line.
Terry R last edited by
one or more non alpha-numeric
You could use the Mark feature, which I suggest as you may otherwise find that you have removed lines you did not wish to do so.
So with Mark (under Search, then mark) have the Find What line containing
Make sure the ‘Bookmark line’ is ticked and have the Search Mode set to 'regular expression. Click on mark All.
All lines containing at least one character which is NOT a number (0-9) or a alpha (a-z & A-Z) will be marked by a symbol at the start of a line (mine is a blue circle).
At this point you could just select the option in the menu (under Search) called Bookmark, then Remove Bookmarked Lines, however i strongly suggest you check at least some of the bookmarked lines as I suspect you will find you may have forgotten other characters which you wish not to select. If so then they can also be added to the regex inside the
, before selecting Mark again, Clear Marks and trying again.