
October 15th, 2009, 10:41 AM
|
|
Registered User
|
|
Join Date: Jul 2009
Posts: 6
Time spent in forums: 55 m 10 sec
Reputation Power: 0
|
|
|
Match chars at end of filename, but not extension
I have a list of file names like this:
Song title (30).mp3
Another song title [02].MP3
A final song (57).wma
What I would like to do is remove those track numbers. The regex I have so far, while not quite working correctly, will match " (57).wma" and replace it with nothing. Instead, I want to preserve the file extension.
Code:
s/(\s?((\[\d\d\]|\(\d\d\))\....)$)//
Is there a way to specify for the $ anchor to start looking x characters from the end, so it won't match the file extension?
Thanks
-Z.
|