Rearranging file name with regular expressions

Advanced Renamer forum
#1 : 02/09-24 07:01
delusionsofgrandeur
Posts: 2
I have a bunch of ebooks that I want to rearrange the file names of. Currently, they are arranged like this...

Alexandra Moody - Wrong Costar_ A YA Enemies-to-Lovers Romance (The Wrong Match Book 2), The.mobi

And I want them to look like this...

Alexandra Moody - The Wrong Match Book 2 - Wrong Costar- A YA Enemies-to-Lovers Romance, The.mobi

In other words, author's name first, series name and book number (the part in parentheses) second, and then the book title. (Also, I want to change the underscore after 'Costar' to a hyphen, but this can easily be done in a separate replace command... it doesn't have to be done in the same step.)

I know the best way to accomplish this is probably with a replace command and regular expressions, but I can't for the life of me figure out what expressions to use to accomplish this. Can anyone help? Thanks in advance!

edited: 02/09-24 07:04
#2 : 02/09-24 11:28
Miguel
Posts: 141
Reply to #1:
Good morning Delusion
Your are right. This can be done with the Replace method and regular expressions.

REPLACE: (\w.*) - (\w.*)_ (\w.*) \((\w.*)\)
REPLACE WITH: $1 - $4 - $2 - $3

As you can see i have divided it into blocks of text and then I have rearranged it with replace method
I hope I have helped you.

Miguel

edited: 02/09-24 20:40
#3 : 10/09-24 19:33
delusionsofgrandeur
Posts: 2
Reply to #2:
Worked like a charm. Thanks!
#4 : 11/09-24 20:04
AUA
Posts: 1
Reply to #2:
I Have Files In Format of Like This which need to be replace like as i shown in before and after

Old Formate
yyyy. Filename - HindiDubbed - 720p
yyyy. Filename - HindiDubbed - 1080p

New Format
Filename - yyyy - HindiDubbed - 720
Filename - yyyy - HindiDubbed - 1080p

can you please help me how to write regular expression cause it won't happend by move or replace method simply
#5 : 11/09-24 20:34
Delta Foxtrot
Posts: 296
Reply to #4:

Hi Aija,

This will probably do it, depending on what's in the "Filename" part of your names. If there's a dash "-" in the filename part it may not work. If you have problems and need more help just include a representative sample of actual filenames.

REPLACE method:
Replace: ([\d]{4})\. ([^-]+)
Replace with: $2 - $1
(there's a space after the "$1")
Occurrence: All
Case sens.: (doesn't matter)
Use regular expressions: CHECKED
Apply to: Name

Screenshot: https://drive.google.com/file/d/1wdJz-QsUjB9oquP Y8TtgYbiVhqwnt1KG/view?usp=sharing

Best,
DF

EDIT: For future reference, it's probably better to start a new thread with a very specific subject line. END EDIT

edited: 11/09-24 20:35