Community
    • Login

    How to remove lines that do not contain ONLY alphanumeric characters.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 1.8k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Nicholas WetzelN Offline
      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.

      1 Reply Last reply Reply Quote 0
      • Terry RT Offline
        Terry R
        last edited by

        @Nicholas-Wetzel said:

        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
        [^0-9a-z]
        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.

        Terry

        1 Reply Last reply Reply Quote 3

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors