Quickly removing numbers from a list

Removing the numbers from a numbered list is pretty easy with regular expressions.

For my KFOG site, many of my playlists started out with numbers, like this:

1.  Steely Dan - Reeling in the Years
2.  Neil Young - Are You Ready for the Country
(News:  Munich)
3.  Bill Withers - Lean on Me
4.  The Stylistics - Betcha By Golly, Wow
(TV:  The Paul Lynde Show)
5.  Jimmy Cliff - You Can Get it if You Really Want
6.  The Raspberries - I Wanna Be With You
(Movie:  Cabaret)
7.  David Bowie - Moonage Daydream)
8.  Yes - Roundabout
(Ian Anderson Interview)
9.  Jethro Tull - Thick as a Brick (BOS)
10.  Faces - Stay With Me

 

To remove them, I just used Find/Replace with these strings:

Find:   \r\d+\. 

(There are two spaces at the end of the Find string.)

Replace:   \r

In plain English, this regular expression:

\r\d+\. 

means:

\r a new line (a carriage return)
\d+ one or more digits: the \d matches a number, and the + means "one or more"
\. a period is a special character in regular expressions that matches any single character; putting a backslash before it means "match just a real period character, not any other character)

So, all together, it means:

Find a new line, followed by one or more numbers, followed by a period, followed by two spaces

and replace that with

just a new line.

(Instead of using the \r return character, I could use ^ to indicate the beginning of the line, but I can't always remember off the top of my head that it's the ^ character that means "starting at the beginning of the line", but I always remember that   \r   is a carriage return.)

That quick search-and-replace gave me exactly what I needed:

Steely Dan - Reeling in the Years
Neil Young - Are You Ready for the Country
(News:  Munich)
Bill Withers - Lean on Me
The Stylistics - Betcha By Golly, Wow
(TV:  The Paul Lynde Show)
Jimmy Cliff - You Can Get it if You Really Want
The Raspberries - I Wanna Be With You
(Movie:  Cabaret)
David Bowie - Moonage Daydream)
Yes - Roundabout
(Ian Anderson Interview)
Jethro Tull - Thick as a Brick (BOS)
Faces - Stay With Me

 

And since I had several playlists with line numbers all in one file, I was able to use this search-and-replace to fix all of them at once. It saves me a lot of time.

 

 

My favorite text editor, BBEdit, has had outstanding support for regular expressions for years. I always enjoy having it magically refine my text.