Help With Book Title Expressions

A swapping-ground for Regular Expression syntax

Help With Book Title Expressions

Postby bibliophile » Sun Mar 03, 2013 4:20 am

Hello,

I'm sure the answer has already posted on this board, but a search has produced nothing. I could use some help creating expressions that will allow me to do the following:

FROM: Title - First Last
TO: First Last - Title

FROM: Title - Last, First
TO: First Last - Title

FROM: Title, Last First
TO: First Last - Title

Any assistance you can offer would be much appreciated. Thank you!
bibliophile
 
Posts: 3
Joined: Sun Mar 03, 2013 4:16 am

Re: Help With Book Title Expressions

Postby Stefan » Sun Mar 03, 2013 10:41 am

bibliophile wrote:Hello,

I'm sure the answer has already posted on this board, but a search has produced nothing. I could use some help creating expressions that will allow me to do the following:

FROM: Title - First Last
TO: First Last - Title

FROM: Title - Last, First
TO: First Last - Title

FROM: Title, Last First
TO: First Last - Title

Any assistance you can offer would be much appreciated. Thank you!


Hi, you are right "the answers has already been posted on this board", mostly in the RegEx sub forum.
But you have to sort your files first and proceed one run for each of the three possibilities.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Help With Book Title Expressions

Postby bibliophile » Sun Mar 03, 2013 9:39 pm

Hi Stefan,

I've already sorted the books into three different folders for that exact purpose.

I get it. It's annoying when newbies ask questions that have likely been asked and answered multiple times. I also believe in the value of being self-sufficient. I am pleased (and grateful to the members of this board) that I was able to locate the expressions I needed for 70% of the renaming tasks I needed to complete by utilizing the advanced search option on this message board.

But I am stuck now and I really could use your help. If you (or anyone reading this) can please help out by either responding directly to question I posed or supplying me with a hyperlink to the forum or thread that my previous searches clearly missed, I would greatly appreciate it.

Thank you,
Bib
bibliophile
 
Posts: 3
Joined: Sun Mar 03, 2013 4:16 am

Re: Help With Book Title Expressions

Postby Stefan » Mon Mar 04, 2013 7:39 pm

Of course, let come the questions and we try to do our very best to support you.


Generally spoken for all posters:

Just ask a short question and also provide real !!! (or alike) paths and files names
how they look now and how the should look after the renaming.

Don't mess around with look-alike example file names,... save us both time.
Provide real file names or be exactly sure your example will fit on your real ones.


.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Help With Book Title Expressions

Postby bibliophile » Tue Mar 05, 2013 6:30 am

Thank you for your assistance!

I need help converting the following (using a real life example this time)

SCENARIO ONE:
FROM: Moby Dick - Herman Melville
TO: Herman Melville - Moby Dick

SCENARIO TWO:
FROM: Moby Dick - Melville, Herman
TO: Herman Melville - Moby Dick

SCENARIO THREE:
FROM: Moby Dick, Melville Herman
TO: Herman Melville - Moby Dick

I have already separated the files for each scenario in their own folder. Now I just need help creating the Regex formula for each scenario above.

Any assistance you can offer would be greatly appreciated. Thanks again.
bibliophile
 
Posts: 3
Joined: Sun Mar 03, 2013 4:16 am

Re: Help With Book Title Expressions

Postby Stefan » Tue Mar 05, 2013 7:47 am

bibliophile wrote:Thank you for your assistance!

I need help converting the following (using a real life example this time)

SCENARIO ONE:
FROM: Moby Dick - Herman Melville
TO: Herman Melville - Moby Dick

SCENARIO TWO:
FROM: Moby Dick - Melville, Herman
TO: Herman Melville - Moby Dick

SCENARIO THREE:
FROM: Moby Dick, Melville Herman
TO: Herman Melville - Moby Dick

I have already separated the files for each scenario in their own folder. Now I just need help creating the Regex formula for each scenario above.

Any assistance you can offer would be greatly appreciated. Thanks again.

Ahh, that are already the remain 30%? Now i get it too.

>>"using a real life example this time"
And you have no extension ;-)
But well done at least that you have now provided two word "Title"

SCENARIO ONE:

FROM:
Moby Dick - Herman Melville.ext
TO:
Herman Melville - Moby Dick.ext

USE:
"Options > Ignore... > [ ]File Extensions" not checked

RegEx(1)
Match: "(.+) - (.+)"
Repla: "\2 - \1"

Explanation:
Match everything till space-hyphen-space and store it in group 1.
Then match the rest and store it in group 2.
On replacement exchange the order of those groups and add space-hyphen-space again yourself.

#########################################

SCENARIO TWO:

FROM:
Moby Dick - Melville, Herman.ext
TO:
Herman Melville - Moby Dick.ext

USE:
"Options > Ignore... > [ ]File Extensions" not checked

RegEx(1)
Match: "(.+) - (.+), (.+)"
Repla: "\3 \2 - \1"


Explanation:
Match everything till space-hyphen-space and store it in group 1.
Then match everything till comma-space and store it in group 2.
Then match the rest and store it in group 3.

#########################################

SCENARIO THREE:

FROM:
Moby Dick, Melville Herman.ext
TO:
Herman Melville - Moby Dick.ext

USE:
"Options > Ignore... > [ ]File Extensions" not checked
RegEx(1)
Match: "(.+), (.+) (.+)"
Repla: "\3 \2 - \1"

Explanation:
Match everything till comma-space and store it in group 1.
Then match everything till a space and store it in group 2.
Then match the rest and store it in group 3.

#########################################

HTH? :wink:

Note:
the provided regex will work well only for two word parts.
Some of then will not work as expected for file names like "The Bar None Ranch - Asprin, Robert Lynn.ext"
But then again that was not the question anyway, isn't it?
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU


Return to Regular Expressions