View Single Post
Old 01-16-2017, 11:20 PM   #1
PERSISTENCE
Member
PERSISTENCE began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jun 2010
Device: NONE
Need help! Template to shorten series name

Hi - I need help to shorten the series name using a template/plugboard!

I want to create a custom column using the following book title - but I am having trouble shortening the series name:
(essentially, I want to use (approx) the first 2 words of the series name)
[SHORTENED SERIES NAME] - series index# - book title

I want to shorten the series name in a particular way - basically it would require 2 steps:
a) I want to strip off the first word (if it is an article - a/an/the)
I can do this with a custom column/using template syntax:
#stripped_series. Template: {series:re(^(A|The|An)\s+,)||}

b) then I want to use the first 2 words (approx) of the series name
BUT THIS IS WHERE I GET STUCK...

I want to use the first 2 words of the series name BUT if the following words appear, they should be included but not counted as one of the '2' words:
any article (a/an/the), conjunction (and/or/&), preposition (of, from..etc), AND any word ending in '.' (full stop) ie any short form like Mr., St. etc.

EXAMPLES:
1) Lord of the Rings and other Tolkien Stories WOULD APPEAR AS
Lord of the Rings
2) Kincaid & James WOULD APPEAR AS Kincaid & James
3) Mr.Fox & Mrs.Chicken mysteries WOULD APPEAR AS Mr. Fox & Mrs. Chicken
4) D.I. Helen Grace series WOULD APPEAR AS D.I.Helen Grace

Can anyone help me with a template that will perform STEP B? (I tried using python syntax strip.string_variable to no avail...I'm just stumped)....

Thanks so much....
PERSISTENCE
PERSISTENCE is offline   Reply With Quote