Page 1 of 1

Remove Switch Sections With Dash

PostPosted: Sat Apr 06, 2019 10:04 pm
by Randman69
Been at this NOT long enough. Made Some progress, asking for expert help.

File: 13Engines - Smoke and Ashes.mp3
1000 Mods - Electric Carve (Official).mp3
5Sos - She So Perfect [Lyrics].mp3

Plan: Smoke and Ashes.mp3
Electric Carve.mp3
She So Perfect.mp3

OR: Smoke and Ashes - 13Engines.mp3
Electric Carve - 1000 Mods.mp3
She So Perfect - 5Sos.mp3

I was messing with Match: (.*?) - (.*?) Repace: \1 or \2 Could only drop the 2nd section & not the 1st....
ex: 5Sos + lost file extention. I get why.

The "OR" example would be best. I'd sure like to learn what I'm missing so far. If anyone knows how to do both, that be awesome!

Re: Remove Switch Sections With Dash

PostPosted: Sun Apr 07, 2019 2:51 pm
by therube
That basically looks right.

1:RegEx
Code: Select all
Match:  (.*?) - (.*)
Replace:  \2 - \1


(I've spaced the Replace: a bit for readability)
Code: Select all
01 Lama Guyrme - Hope For Enlightenment.mp3   |      Hope For Enlightenment   -   01 Lama Guyrme.mp3
02 Lama Guyrme - Guru Rinpoche.mp3   |      Guru Rinpoche   -   02 Lama Guyrme.mp3
03 Lama Guyrme - The Tsok Offering.mp3   |      The Tsok Offering   -   03 Lama Guyrme.mp3
04 Lama Guyrme - Calling The Lama From Afar.mp3   |      Calling The Lama From Afar   -   04 Lama Guyrme.mp3
05 Lama Guyrme - Longevity Prayer To Kalu Rinpoche.mp3   |      Longevity Prayer To Kalu Rinpoche   -   05 Lama Guyrme.mp3
06 Lama Guyrme - Chenrezi.mp3   |      Chenrezi   -   06 Lama Guyrme.mp3


If you're looking the extension, check your settings for, Renaming Options -> Ignore --> (File Extensions).

Re: Remove Switch Sections With Dash

PostPosted: Wed Apr 17, 2019 12:43 am
by bru
The ?-modifier stops matching upon 1st-occurence of any text-string you specify.
Your Group1 (.*?) - matches anything until 1st-occurence of Space-Space.
But Group2 (.*?) matches nothing, because no 1st-occurence follows.

Like therube says, just omit ? in Group2 to yield much better results.
IF you need to always lose any trailing (text) or [text], you can use this:

BRU Match/Replace:
(.*?) - ([^][()]*)( [][()])*([^][()]*)*([][()])*$
\2 - \1

If you meant this for BRC, the equivalent is:
brc32 /regexp:"(.*?) - ([^][()]*)( [][()])*([^][()]*)*([][()])*$:\2 - \1"