#1 2008-01-11 08:19

Los Loco Lobo
Member
Registered: 2007-12-29
Posts: 4

Regular Expressions

With renaming ebook files, I would like to have Renamer to take the author first name and author last name and reverse them with a comma-space. I tried the example in the help files but it didnt work. I must be doing something wrong as it didnt do anything.

Learning this I could also apply it to move other parts as well. There is an infinite (or so it seems) variety to how ppl name their files. Some even put author name last.

Also, is there a way to have Renamer use the first extention? An example is .jpg.rtf.txt.rar and .jpg.html.rar.  Some authors have different pen names and I like to put the name the book was authored by at the end.

Thank you for any help.

Offline

#2 2008-01-11 17:09

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Regular Expressions

Yes that's doable with ReNamer.

You have to find some common parts of the file names,
f.ex. for  "example file - name (2008)"
part 1 goes till an hash-, part 2 from open parenthesis till the closing counter part, ...e.t.c. pp

so you have to analyze your file names to find such common parts
and then find the right RegEx meta chars to catch them.
To build the new name from this catching should be no problem.

If you need help please post a few (up to 10) real file names (you may modify the words but not the structure pls)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2008-01-16 13:19

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,378

Re: Regular Expressions

As Stefan said, it is possible, but we'll need to know the structure of the filenames.

Just to start up, consider the following RegEx rule:

Expression: (.+?) (.+?) (.*)
Replace: $2, $1 $3

Sample file: "First Last - Title of the book" will be converted to "Last, First - Title of the book"

Offline

#4 2008-02-04 13:45

Los Loco Lobo
Member
Registered: 2007-12-29
Posts: 4

Re: Regular Expressions

Wow! The example above works great with 2 word names. What would it be for names below?


A. Bertram Chandler - Giant Killer v1.0.html.rar
H F W Tatham - The True King.cover.html.pdf.txt.rar
Jeannine D Van Eperen - Willow Spring.txt.zip


And when done -

Chandler, A Bertram - Giant Killer v1.0.html.rar
Tatham, HFW - The True King.pdf.rar
Van Eperen, Jeannine D - Willow Spring.txt.zip


Another question - is their a way to put a space in front of a capital letter? Example file name -

eb-YevaWiest-PaybacksAreHell[Rtf].zip

Thank you so much for the program and the forum to get help.

Offline

#5 2008-02-16 15:29

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,378

Re: Regular Expressions

Sorry fur such late reply...

Unfortunately your variations of files make it impossible to write a single regular expression to swap first and last names, because as I see both parts can be completely anything and any combination of those anythings. It is not as if you can say that first name is 1-st word, and second name is 2-nd word, in which case it is easy to swap them. But in your case, first and last names are all over the place.

For example: "Jeannine D Van Eperen", there is no way even for me to know where the first name stars and ends, and where last name starts and ends, unless I know what the first and the last names are. Hope this illustrates the problem.

The only solution I can see from top of my head is to group files by their structure, for example:
Group A... 1-st word is first name, rest of words until dash is last name;
Group B... First 2 words is first name, rest of words until dash is last name;
Group C... Last 2 words before dash is last name, the rest if first name;
etc.

And then process them with individual regular expressions for each case.

Regarding your second question, have a look at this topic: Insert between words
Which brings back an older topic: Insert blank space between lowercase and uppercase

Offline

Board footer

Powered by FluxBB