Remove varying parts of folder names

A swapping-ground for Regular Expression syntax

Remove varying parts of folder names

Postby bearart » Thu Dec 10, 2015 7:02 pm

Hello, having a bit of trouble getting the RegEx option to properly remove specific text blocks from some folders. Using an online RegEx tester (https://regex101.com/), I've managed to get a primitive/clunky, yet working expression to remove all the necessary text blocks from my folders. The issue arises that when I paste it into BRU's box, it does not seem to work.
Expression:
Case should be ignored! Using modifiers gi
Code: Select all
(-AAC|.MP3|\[HDAudio\]|-FLAC|\[testfiles.com\])


So my window looks like this:
RegEx (1)
In Match
Code: Select all
(-AAC|.MP3|\[HDAudio\]|-FLAC|\[testfiles.com\])

In Replace I've tired empty or \1; empty, nothing happens; \1 the renames are incorrect. *Not really sure what should be there, I just want the named tag strings deleted.

Sample folders to rename:
1950.TestAudio-AAC[HDAudio]
2034-New.Tracks.MP3[testfiles.com]
AlbumHQ_Sound-FLAC[TestFiles.com][HDAUDIO]
975.TestTracksHD-aac[testfiles.com]

After running the top RegEx in the online tester tool and confirming again in Notepad++ that should properly rename the folders to:
1950.TestAudio
2034-New.Tracks
AlbumHQ_Sound
975.TestTracksHD

I'm perfectly fine with my arbitrary adding the individual "tags" I'll need to remove, also makes it easy to see at a glance, and add if I find any new patterns. Still any help in this manner would be appreciated.
bearart
 
Posts: 1
Joined: Thu Dec 10, 2015 5:54 pm

Re: Remove varying parts of folder names

Postby Renamer34 » Fri Jan 08, 2016 9:43 pm

Try this in Match:
(.*)(-AAC|.MP3|\[HDAudio\]|-FLAC|\[testfiles.com\])
And in Replace:
\1
You need to match and replace the initial part you want to keep. There's a discussion of this in the manual.
Renamer34
 
Posts: 3
Joined: Fri Jan 08, 2016 8:21 pm


Return to Regular Expressions