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 12-16-2011, 11:37 AM   #1
ElfN
Enthusiast
ElfN began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2010
Device: Samsung SM-T290
Filename plugboard

I've got this:

{#stripped_title:re(([a-z]+|[A-Z]+|[0-9]+)\s+,)||}

And it works but it's SO not giving me what I want. It strips all but the last word or two of the title and includes apostrophes and commas, strips any trailing "s". Arg.

This is entirely because I don't know exactly what I'm doing. I program but the regex I'm used to using isn't Python and I'm having trouble making the mental switch-over.

I've got a stripped title that works great and I use this field in a number of places.

{title:re(^(A|The|An)\s+,)||}

With a \s+ (why is the "s" being escaped? Not a clue) and a comma. No clue what that's for either.

What I want is a the title with no spaces or punctuation. That's all.

Can someone help?

Thanks.

Nori
ElfN is offline   Reply With Quote
Old 12-16-2011, 02:06 PM   #2
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,803
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by ElfN View Post
I
{title:re(^(A|The|An)\s+,)||}

With a \s+ (why is the "s" being escaped? Not a clue) and a comma. No clue what that's for either.

What I want is a the title with no spaces or punctuation. That's all.

Can someone help?

Thanks.

Nori
\s+ Whitespace (0 or more) followed by a comma
Isn't comma space more common?
theducks is offline   Reply With Quote
Old 12-19-2011, 02:35 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
Quote:
Originally Posted by theducks View Post
\s+ Whitespace (0 or more) followed by a comma
Actually, it's one or more. 0 or more would be an asterisk.
Manichean is offline   Reply With Quote
Old 12-19-2011, 10:55 AM   #4
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,803
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Manichean View Post
Actually, it's one or more. 0 or more would be an asterisk.

I was thinking * but still typed +
theducks is offline   Reply With Quote
Old 12-23-2011, 08:57 AM   #5
ElfN
Enthusiast
ElfN began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2010
Device: Samsung SM-T290
So, how do I do it? I'm trying to create a file name that's the initials of the author(s) (I can do that), the initials of the series (ditto here) and the first 18 or 20 characters of the title minus any spaces and punctuation. ?
ElfN is offline   Reply With Quote
Old 12-23-2011, 12:20 PM   #6
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ElfN View Post
... the first 18 or 20 characters of the title minus any spaces and punctuation. ?
This template removes all non-alphabetic characters and shortens the result to a max of 18 characters, which is what I think you are asking for.
Code:
{title:'shorten(re($, '\W', ''), 18, '', 0)'}
chaley is offline   Reply With Quote
Old 12-30-2011, 09:29 AM   #7
ElfN
Enthusiast
ElfN began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2010
Device: Samsung SM-T290
I didn't do it the way you described but I got it done. I'm getting this, it's just really slow. I'm a bit of a one trick pony. I learn one way to do things and it's a struggle to integrate other ways of doing it . . . but only at the beginning.

Nesting stuff, which is what you've done with the shorten and the replace, is awesome. I'm going to keep referring back to this.

Thanks.

Nori
ElfN is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Metadata Plugboard IxiaAurea Calibre 1 11-05-2011 01:13 PM
Plugboard doesn't appear to take effect PerspexAvenger Calibre 1 06-07-2011 04:03 AM
Plugboard Question gweminence Calibre 3 01-11-2011 01:34 PM
K3 plugboard basics jackie999 Calibre 13 12-13-2010 03:48 AM
Problem with Metadata Plugboard cheveguerra Calibre 3 10-05-2010 12:00 PM


All times are GMT -4. The time now is 11:05 PM.


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