Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 06-04-2011, 09:34 AM   #1
curiosity
Nameless Being
 
Help needed with an expression if possible

G'day,

G'day to all,

I found this expression in the forums but need help with adding isbn as well.
I just can't get my help around expressions, I've tried for hours and can't get it to work for me and am in need of expert help from those smarter than I.

^(?P<author>[^-]+)(\s*-\s*(\[?(?P<series>[^-0-9]+)\s*(?P<series_index>[0-9.]+)?]?)?)?.*?-\s*(?P<title>[^\]{[()]+\w)

The above expression when importing books works a treat to a point for me - I name my files as below - its there ALMOST ... the isbn appears with the title and not in its proper place..

John, P. Doe - Keeping The Piece 01 - Out there in space - 123456789123.epub

My title returns = Out there in space - 123456789123
Authors = John, P. Doe
Series = Keeping the Piece
Series Index = 01
ISB = No match

Alternately is there a plugin that can accommodate this for those that are expression handicapped like me

Thanking you in advance for your assistance.

Regards..
  Reply With Quote
Old 06-04-2011, 06:34 PM   #2
curiosity
Nameless Being
 
I got lucky

^(?P<author>[^-]+)(\s*-\s*(\[?(?P<series>[^-0-9]+)\s*(?P<series_index>[0-9.]+)?]?)?)?.*?-\s*(?P<title>[^\]{[()]+\w)\s*-s*(?P<isbn>.+)
  Reply With Quote
Old 06-07-2011, 02:14 AM   #3
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
I don't know if you've alreday read it, but there's a tutorial on regular expressions available over in the conversion section.
Manichean is offline   Reply With Quote
Old 06-07-2011, 05:19 AM   #4
curiosity
Nameless Being
 
I'm aware of the tut - if I were apt enough to understand it would be great unfortunately not as smart as some
  Reply With Quote
Old 06-07-2011, 12:10 PM   #5
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
I get that a lot. If you were to give some more concrete criticism other than "it's just too difficult", I'd try to improve it.
Manichean is offline   Reply With Quote
Old 06-07-2011, 12:43 PM   #6
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
Quote:
Originally Posted by Manichean View Post
I get that a lot. If you were to give some more concrete criticism other than "it's just too difficult", I'd try to improve it.
Manichean:

Would it be possible to add some more real life examples to it? Or perhaps some of the more complex examples that power or advanced users are using? I know you add examples but maybe something more complex might be helpful. Or perhaps some sticky post in the forum of more commonly used reg expressions. Just a thought.
nynaevelan is offline   Reply With Quote
Old 06-07-2011, 01:08 PM   #7
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: 29,792
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Lightbulb The Original, The Goal. Cookbook

I have been saving (in a Notepad file)., Solutions that worked

The Original -> the goal (sample)

Search: pattern and settings (I use Sigil for most body edits.)
Replace: the term

Pitfalls, warnings and restrictions
theducks is online now   Reply With Quote
Old 06-07-2011, 06:56 PM   #8
Debby
Connoisseur
Debby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enoughDebby will become famous soon enough
 
Debby's Avatar
 
Posts: 75
Karma: 600
Join Date: Jul 2008
Location: Depends Upon the Season.....
Device: Cybook, Sony & ipad
I have been adding expressions to a spreadsheet when I have success. Using the Quick Preferences plugin has also helped. Being able to name and clear expressions that do not work has made it easier for me.

I would love to see a sticky dedicated to expression examples that have been tested (similar to the plugin index). I find I am able to figure most things out when I have a very concrete example to follow.

For the tutorial (which I have been to several times) I would appreciate some real examples. Perhaps starting with something as simple as Name and Title and demonstrating the different expressions used. Continuing onto the series, removing page numbers and other headers/footers.

To give a concrete example:
FN LN - Title
LN, FN - Tile
Title - FN LN


LN, FN - [Series #] - Title
FN LN (Series #) Title

Series Name - Title , Title # - Author
Series # - Title - LN _ FN

Part of what makes this so challenging (and interesting) it that there seem to be multiple ways to get to the same results.

I would be happy to send my spreadsheet to Manichean if it would be of any value to start an examples page.
Debby is offline   Reply With Quote
Old 06-09-2011, 01:54 AM   #9
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
I'll see what I can do about more examples this weekend, I should have some time then. As for a list of commonly used expressions/expressions that worked, I don't have any source material for that, since I always create the regexes I need from scratch taylor-made to the specific problem I'm trying to solve, but if you all post some expressions you'd like to see, I'll try to compile them into a new thread. Send your suggestions via PM or answer in this thread.
Manichean is offline   Reply With Quote
Old 06-09-2011, 06:43 PM   #10
penguinaka
Quack! Quack!
penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.
 
penguinaka's Avatar
 
Posts: 92
Karma: 9176
Join Date: Apr 2011
Location: Florida
Device: kindle 3 & sony daily prs950sc
I agree there needs to be a sticky where there is a list of expressions that work and can be added to. Reading and working with regular expressions is like trying to learn an alien language. Also the expressions change depending on what language. It appears that calibre uses python regex.

I downloaded regexbuddy 3. which helps you craft them but it seems like calibre just won't accept some stuff that it says is good.

Anyway a sticky would be great. because your examples in the manual sad to say suxor

I'm going to start a new thread because i have a few more complicated regex questions and i don't want it buried at the end of a thread. cheers. btw thanks for creating such a great program!
penguinaka is offline   Reply With Quote
Old 06-10-2011, 01:52 AM   #11
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by penguinaka View Post
Anyway a sticky would be great. because your examples in the manual sad to say suxor
Okay, time for Criticism 101: This is not how you do it. Telling me the examples "suxors" doesn't help me improve them at all- give details. Preferrably something like "I didn't understand this example here, because...", otherwise I just won't change anything, because I honestly don't know what to change after your thoughtful input.

Quote:
btw thanks for creating such a great program!
Just to clarify- I had no part in creating or maintaining Calibre. About the only thing I contributed is forum time, one icon and some translation strings.
Manichean is offline   Reply With Quote
Old 06-10-2011, 02:16 AM   #12
curiosity
Nameless Being
 
Quote:
Originally Posted by Manichean View Post
I get that a lot. If you were to give some more concrete criticism other than "it's just too difficult", I'd try to improve it.
I have to laugh - I offered no criticism "I'm aware of the tut - if I were apt enough to understand it would be great unfortunately not as smart as some"

I didn't say "it was too difficult" to criticise you or anyone else - I simply said I was not apt enough to understand it, I'll say it in plainer English - I'm stupid when it comes to any type of coding or understanding code - I'm dumb - not as smart as some - perhaps I'm too thick to grasp the fundamentals - there fore I turn to my piers for assistance - or in this case got lucky seeing the code being used elsewhere"

All I wanted to know was how to add isbns at the end - I got lucky by cutting pasting code to see if it worked - I still don't understand how it works or why..

But thank you for the feedback...
  Reply With Quote
Old 06-10-2011, 02:39 AM   #13
penguinaka
Quack! Quack!
penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.penguinaka can eat soup with a fork.
 
penguinaka's Avatar
 
Posts: 92
Karma: 9176
Join Date: Apr 2011
Location: Florida
Device: kindle 3 & sony daily prs950sc
Quote:
Originally Posted by Manichean View Post
Okay, time for Criticism 101: This is not how you do it. Telling me the examples "suxors" doesn't help me improve them at all- give details. Preferrably something like "I didn't understand this example here, because...", otherwise I just won't change anything, because I honestly don't know what to change after your thoughtful input.



Just to clarify- I had no part in creating or maintaining Calibre. About the only thing I contributed is forum time, one icon and some translation strings.
Did you see me quote your post in the thread? No I didn't... I just spoke in general that there needs to be a sticky with more about regex with better examples and people can post their own to it, because the general consensus is the manual does blow chunks in that area. Also I wasn't thanking you for the creation of calibre, but we are in a calibre forums in which the developers do frequent so a thanks went out to them! So they understand that all though I feel the manual needs work I do greatly appreciate the software.

And people that use the word honestly in their wording for example, "because I honestly don't know what to change after your thoughtful input." Imply that they haven't been honest before.

So the only thing I can see that you accomplished with you quoting my post was a successful troll.

Now as far as the manual. If you wrote the examples in it then you need to go back to the drawing board. There are very few example and most are not used in a way that it would be used in calibre.

I know this because I have been through it plus a dozen other sites and forums scouring them for regex that would be useful in calibre. Cheers!

Last edited by penguinaka; 06-10-2011 at 02:45 AM.
penguinaka is offline   Reply With Quote
Old 06-10-2011, 03:03 AM   #14
curiosity
Nameless Being
 
I apologise to those reading this thread if I'd known it was going to be such an issue asking a simple question I would have gone without..

Regards
  Reply With Quote
Old 06-10-2011, 04:33 AM   #15
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
Quote:
Originally Posted by curiosity View Post
I apologise to those reading this thread if I'd known it was going to be such an issue asking a simple question I would have gone without..

Regards
Never think that, although some discussions may become heated, that just shows how passionate many feel about the subject.
nynaevelan is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Expression Logan06 Library Management 5 05-06-2011 04:09 PM
Need help with expression Gurkburken Conversion 1 03-08-2011 02:20 PM
Regular expression - Example needed americhanac Conversion 1 02-08-2011 03:47 AM
Regular Expression Help Needed dloyer4 Calibre 1 07-25-2010 10:37 PM


All times are GMT -4. The time now is 12:00 PM.


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