Community
    • Login

    Trying to remove a line with only year #### for text

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 447 Views
    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.
    • DawnD
      Dawn
      last edited by

      Hello there I was wondering if there is a easier way to remove only lines with numbers.

      I will explain: I do a google search for a specific “Artist” for music like “Garth Brooks” and then I click on the tab “Albums” and then a big list of albums shows up and sometimes there are so many I need to hit the little button to show all the albums.
      Next I copy the list of “Album Titles” by highlighting the “Titles” but then the “Year” of release is also copied. The only way to remove the “Year” is to copy (1) title at a time as far as I can tell. So I copy the entire selection and then I paste it into the “Notepad++” as a list and then it shows like this:

      Album Title
      Year four digits
      and then it keeps repeating until all the album titles and years are listed. Sometimes its under 10 sometimes its over 20.

      So I normally go to the bottom of the list and double click on the year and hit “Backspace” on keyboard. And then I go up to the top removing each year and then I go to the top and click Edit>Line Operations>Remove Empty Lines. And then it looks much neater.

      I normally copy about 10 artists/groups onto notepad++ and then I save them by the artist/group name and then once I remove all the years I re-save the same title but with a x at the end so I know what album list I removed years from and then I move on until there all finished.

      This takes me forever. And most sites I find with album titles based on artist/group have years under the titles or after the titles. And I want to remove the years from the list as quickly as I can.

      So far double clicking and pressing “Backspace” is all I can do to remove the years. If there was a quicker way for search for the years I would prefer it. But sometimes the years are like 1992, 1998,2003,2000, I can’t change them every single time. I just know there are #### four random numbers and there is nothing else on the line before or after the numbers. Its there any tips or ideas someone could give me to quickly do this.

      And by the way I do know Ctrl+8 dose the empty line removal. I will make a ahk for that once I know how to remove the number only lines. Thanks everyone in advance.

      PeterJonesP 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Dawn
        last edited by PeterJones

        @Dawn ,

        Regular Expression mode is your friend.
        FIND WHAT = ^\d{4}\R
        REPLACE WITH = (empty)
        SEARCH MODE = Regular Expression

        will search for lines that only contain 4 digits and the newline sequence, and replace it with nothing (ie, delete it)

        ----

        Useful References

        • Please Read Before Posting
        • Template for Search/Replace Questions
        • Formatting Forum Posts
        • Notepad++ Online User Manual: Searching/Regex
        • FAQ: Where to find other regular expressions (regex) documentation
        1 Reply Last reply Reply Quote 2
        • PeterJonesP
          PeterJones @Dawn
          last edited by PeterJones

          @Dawn said in Trying to remove a line with only year #### for text:

          I will make a ahk for that once I know how to remove the number only lines.

          BTW: You can record Search/Replace and Empty Line Removal commands into the same macro. No need to use the external AHK tool – you can record a macro and assign it your own keystroke completely inside Notepad++, no external service needed.

          DawnD 1 Reply Last reply Reply Quote 3
          • DawnD
            Dawn @PeterJones
            last edited by

            @PeterJones I have heard about the macros before but I have not edited any or really worked with them from notepad++.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors