Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 04-14-2012, 06:41 AM   #1
JCSullivan
Chief Inspector Gamache
JCSullivan began at the beginning.
 
JCSullivan's Avatar
 
Posts: 123
Karma: 12
Join Date: May 2010
Location: Canada eh!
Device: Viewsonic
Calling Expression experts

I'm trying to get the expression to ignore anything before the author's name and, perhaps anything after the Title but this is as far as I got.

I'm reading the tutorial http://manual.calibre-ebook.com/regexp.html but not getting far.

Thanks
Attached Thumbnails
Click image for larger version

Name:	calibre001.gif
Views:	228
Size:	32.2 KB
ID:	85257  
JCSullivan is offline   Reply With Quote
Old 04-14-2012, 11:07 PM   #2
speakingtohe
Wizard
speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.speakingtohe ought to be getting tired of karma fortunes by now.
 
Posts: 4,812
Karma: 26912940
Join Date: Apr 2010
Device: sony PRS-T1 and T3, Kobo Mini and Aura HD, Tablet
If you have a lot of books like that you could use search and replace with
\d\d-\d\d-
\d\d\d\d


Probably an expression on import would work but I am wimpy in that area.
Helen
speakingtohe is offline   Reply With Quote
Advert
Old 04-15-2012, 05:19 AM   #3
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
As long as the filesname follow your example, here's a quick solution.
Code:
\d+-\d+-(?P<author>.+) - (?P<title>.+) \d+
If you want the date as published field you can alter it to
Code:
\d+-\d+-(?P<author>.+) - (?P<title>.+) (?P<published>\d+)
Perkin is offline   Reply With Quote
Old 04-15-2012, 08:49 AM   #4
JCSullivan
Chief Inspector Gamache
JCSullivan began at the beginning.
 
JCSullivan's Avatar
 
Posts: 123
Karma: 12
Join Date: May 2010
Location: Canada eh!
Device: Viewsonic
Quote:
Originally Posted by speakingtohe View Post
If you have a lot of books like that you could use search and replace with
\d\d-\d\d-
\d\d\d\d


Probably an expression on import would work but I am wimpy in that area.
Helen
Thanks Helen

Quote:
Originally Posted by Perkin View Post
As long as the filesname follow your example, here's a quick solution.
Code:
\d+-\d+-(?P<author>.+) - (?P<title>.+) \d+
If you want the date as published field you can alter it to
Code:
\d+-\d+-(?P<author>.+) - (?P<title>.+) (?P<published>\d+)
Thanks Perkin, I'm going to try this out later.

Your "d+" expression now explains better what the tutorial says about "\d is equivalent to [0-9]" and also helps me understand the expression better.
JCSullivan is offline   Reply With Quote
Old 04-15-2012, 11:28 AM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,371
Karma: 58053698
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Decoding the above:
anything not inside a ( ) pair is not captured and is discarded.
The term does need to match what is there for this to work (at all )
theducks is offline   Reply With Quote
Advert
Old 04-15-2012, 12:08 PM   #6
JCSullivan
Chief Inspector Gamache
JCSullivan began at the beginning.
 
JCSullivan's Avatar
 
Posts: 123
Karma: 12
Join Date: May 2010
Location: Canada eh!
Device: Viewsonic
Thank you - that helps even more.
It's great to learn step by step using examples (tutorials are excellent but sometimes, this is better)
I'm very graphical and all your replies are really appreciated.
JCSullivan is offline   Reply With Quote
Old 04-17-2012, 03:54 AM   #7
JCSullivan
Chief Inspector Gamache
JCSullivan began at the beginning.
 
JCSullivan's Avatar
 
Posts: 123
Karma: 12
Join Date: May 2010
Location: Canada eh!
Device: Viewsonic
Drag-n-drop

Using a test file and an expression with the above information and everything worked well. (image 1)

But if I drag-n-drop it doesn't work (image 2)

Am I doing something wrong.

Thanks
Attached Thumbnails
Click image for larger version

Name:	calibre04.gif
Views:	200
Size:	263.3 KB
ID:	85373   Click image for larger version

Name:	calibre05.gif
Views:	194
Size:	179.1 KB
ID:	85374  
JCSullivan is offline   Reply With Quote
Old 04-17-2012, 06:37 AM   #8
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
Remove the [] from the expression, or change to ().

They mean that you want to use inclusive (or exclusive) characters, or a range of characters
e.g. [a-o] means any lower case letter from a to o (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
[a-oxz] means any lower case letter from a to o or x or z

Last edited by Perkin; 04-17-2012 at 06:43 AM.
Perkin is offline   Reply With Quote
Old 04-17-2012, 07:48 AM   #9
JCSullivan
Chief Inspector Gamache
JCSullivan began at the beginning.
 
JCSullivan's Avatar
 
Posts: 123
Karma: 12
Join Date: May 2010
Location: Canada eh!
Device: Viewsonic
Thank you Perkin.

Again, it worked in test mode but not in drag-n-drop as can be seen.
Could it be because I'm using d-n-d????

Thanks
Attached Thumbnails
Click image for larger version

Name:	calibre06.gif
Views:	187
Size:	58.4 KB
ID:	85385  
JCSullivan is offline   Reply With Quote
Old 04-17-2012, 08:19 AM   #10
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
Just use .+ to match all the garbage after the ' - ' seperator

Code:
(?P<title>.+) - .+
Perkin is offline   Reply With Quote
Old 04-17-2012, 10:08 AM   #11
JCSullivan
Chief Inspector Gamache
JCSullivan began at the beginning.
 
JCSullivan's Avatar
 
Posts: 123
Karma: 12
Join Date: May 2010
Location: Canada eh!
Device: Viewsonic
Thank you again.

This does NOT work for me.

Could (or has) anyone actually tried it out by using drag-n-drop?

Is it a "bug" (I hate saying that, sorry) or is it a limitation and therefore not available using drag-n-drop.

Obviously it is reading the metadata from the mp3 file because the author's name is NOT part of the file name.
JCSullivan is offline   Reply With Quote
Old 04-17-2012, 10:37 AM   #12
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,673
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Drag and drop is no different to using add. It will use your regular expression for a text file. However I notice you still had "Get metadata from file contents" ticked in a screenshot above, so if you drag/dropped an epub or mobi for instance it is going to use title/author metadata from inside the file, NOT evaluate your regex. If relying on filenames/regex is how you want to do your imports, then untick that other option.

Apologies if I missed it but I haven't seen you post the actual filename of the file you are drag/dropping. I see lots of screenshots of regexes and the result, but not what the actual name of the file is. If your "plan" for the regex was based on a flawed assumption then everyone's suggestions to tweak it aren't going to do any good...
kiwidude is offline   Reply With Quote
Old 04-17-2012, 10:53 AM   #13
JCSullivan
Chief Inspector Gamache
JCSullivan began at the beginning.
 
JCSullivan's Avatar
 
Posts: 123
Karma: 12
Join Date: May 2010
Location: Canada eh!
Device: Viewsonic
Thanks KiwiDude

That worked great - I knew I was doing something wrong.
It was the actual file name with the exception that it was an ".mp3" rather than a ".txt" Testing would not allow me to use ".mp3" as an extension.

Thank you everyone else with your help and patience - I learnt a lot from your expression examples.
JCSullivan is offline   Reply With Quote
Reply

Tags
expresions


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling all font and code experts ltr Kobo Reader 7 12-09-2011 08:28 PM
CSS Experts Japes Sony Reader 8 06-24-2011 09:07 AM
PRS-600 Font experts . help please jacko5 Sony Reader 7 03-15-2011 12:39 PM
Hello experts, Vijay Introduce Yourself 10 11-22-2010 12:29 PM
Question to Experts srinivasvaradar Sony Reader 3 09-30-2007 04:05 PM


All times are GMT -4. The time now is 02:13 PM.


MobileRead.com is a privately owned, operated and funded community.