Removing upto a character

A swapping-ground for Regular Expression syntax

Removing upto a character

Postby enhompe » Thu Jan 10, 2019 3:43 am

I have a bunch of mp3 files that start with a track number like this: 02_Starving Artist - The Hunger Song.mp3 and I would like to remove the first three characters of each. I can't use the Remove (5) function because there are other tracks that don't have numbers and underscores, and they have to remain unchanged. So I have to Remove up to and including the Underscore. Your help is greatly appreciated.
enhompe
 
Posts: 7
Joined: Sat Oct 25, 2014 4:30 pm

Re: Removing upto a character

Postby Admin » Thu Jan 10, 2019 1:24 pm

Hi , do you need to remove first 2 digits and _ if there is a _ in 3rd position?
Admin
Site Admin
 
Posts: 1568
Joined: Tue Mar 08, 2005 8:39 pm

Re: Removing upto a character

Postby therube » Thu Jan 10, 2019 1:50 pm

That is what it sounds like, so I'd try:

1:RegEx
Code: Select all
Match:  (^\d\d_)(.*)
Replace:  \2
therube
 
Posts: 473
Joined: Mon Jan 18, 2016 6:23 pm

Re: Removing upto a character

Postby enhompe » Thu Jan 10, 2019 5:27 pm

Yes, that's what I need to do. I'll try your regex and post the results. Thank you for your help.
enhompe
 
Posts: 7
Joined: Sat Oct 25, 2014 4:30 pm

Re: Removing upto a character

Postby enhompe » Wed Jan 16, 2019 9:26 pm

Works perfect! Thank you!!!
enhompe
 
Posts: 7
Joined: Sat Oct 25, 2014 4:30 pm


Return to Regular Expressions