Trying to remove a line with only year #### for text
-
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.
-
@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
-
@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.
-
@PeterJones I have heard about the macros before but I have not edited any or really worked with them from notepad++.