removing sections of names from files

A swapping-ground for Regular Expression syntax

removing sections of names from files

Postby ChocolateBob » Mon Sep 01, 2008 8:43 pm

I have several hundred files with names such as

(FAS)Sweetmusic (dc123197476).wma

I would like to remove the section (dc123197476) from each file, the problem is that the code (dc123197476) will change from file to file. The start (dc.........) will always be the same, however the number that comes after the dc will be different for each. Is there a way to remove the tag (dc.........) no matter what number come after the dc ? Additionally there may be multiple open and close bracket fields inside the filename. For example LarryLovesLinda (into) (music by Boston) (dc54235235).wma.. Thanks in advance for any help.

Chocolate
ChocolateBob
 
Posts: 1
Joined: Sun Aug 31, 2008 8:50 am

Re: removing sections of names from files

Postby Admin » Mon Sep 01, 2008 8:55 pm

You should be able to use normal regular expression logic. Something like:

(FAS)(.*)(\(dc)(\d*)(\))

\1\2\3\5


or something along those lines....



Jim
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions