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 11-04-2017, 11:30 AM   #1
font332
Connoisseur
font332 began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Dec 2015
Device: kpw2
Splitting multiple author names - RegEx little modification?

Hello

So the basic RegEx is:

Code:
authors_split_regex = '(?i),?\\s+(and|with)\\s+'
and I have some authors separated by "; " e.g. "Author; Second Author; Third"

How for such case the RegEx could look like?
font332 is offline   Reply With Quote
Old 05-25-2020, 07:19 AM   #2
font332
Connoisseur
font332 began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Dec 2015
Device: kpw2
Bump
font332 is offline   Reply With Quote
Advert
Old 05-25-2020, 09:57 AM   #3
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,818
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Bumping is frowned upon.
Necro-bumping is really frowned upon
theducks is offline   Reply With Quote
Old 05-25-2020, 10:00 AM   #4
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Waiting over two years for a response before bumping shows an incredible level of patience.
jhowell is offline   Reply With Quote
Old 05-25-2020, 06:08 PM   #5
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,590
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by jhowell View Post
Waiting over two years for a response before bumping shows an incredible level of patience.
↑ ↑ ↑ ✔

Or font332 was hibernating, as most of us have been forced/coerced into doing recently.

Hopefully a regex guru (which I'm not) will give font332 an answer to the question he/she posted in 2017.

Even Qt and MS are sometimes quicker than that

BR
BetterRed is offline   Reply With Quote
Advert
Old 05-25-2020, 08:52 PM   #6
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
With the emoticon, I can't decide if @font332 is being serious or not. But...

My first thought was simply:

Code:
(?i),?\\s+(and|with|;)\\s+
But, there will probably not be any spacing before the semi-colon.

I think the following works:

Code:
(?i),?(\\s*;\\s*|\\s+(?:and|with)\\s+)
I haven't done much testing with this. The only issue I can see is if you had "; and". In that case, the "and" would be part of the name.
davidfor is offline   Reply With Quote
Old 05-26-2020, 11:01 PM   #7
font332
Connoisseur
font332 began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Dec 2015
Device: kpw2
Thanks everyone for the interest.

In fact I think I've probably solved my problem at that time, but then I lost my library and forgot the formula and regex also. It's been already few times in my life re-learning the regex, but we have to know when to say stop. That's partly why I bumped this dusty topic.

Thank you @davidfor for the formula, it probably doesn't work tho.
I say probably because the way how I checked this is that normally when we are typing the authors in author field and we type "&" symbol, calibre will start to give a list of suggestion for another author. This doesn't happen for ";" symbol.
I think anyway I will not make life more complicated then necessary and I will give up this idea and just convert and use for the future the "&" symbol.
font332 is offline   Reply With Quote
Old 05-27-2020, 12:32 AM   #8
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by font332 View Post
Thank you @davidfor for the formula, it probably doesn't work tho.
I say probably because the way how I checked this is that normally when we are typing the authors in author field and we type "&" symbol, calibre will start to give a list of suggestion for another author. This doesn't happen for ";" symbol.
I think anyway I will not make life more complicated then necessary and I will give up this idea and just convert and use for the future the "&" symbol.
For typing into the author field it probably won't work. The "&" appears to be the trigger the end of an author and to show the drop-down for the next. I think the tweak is more for when calibre is parsing the full author string. Such as when getting the author from the metadata of an existing book. But, it also parses the author when save the changes in the metadata editor.
davidfor is offline   Reply With Quote
Old 05-28-2020, 12:47 AM   #9
font332
Connoisseur
font332 began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Dec 2015
Device: kpw2
Thanks for clarification
font332 is offline   Reply With Quote
Reply

Tags
calibre, regex, regular expression


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk changing author names to author sort in tag browser AussieTupp Library Management 6 02-05-2017 04:22 AM
Regex to find author names all in uppercase? Vortex Library Management 3 08-03-2016 06:50 PM
Splitting multiple html files? nqk Editor 5 11-27-2015 02:08 AM
Splitting of multiple authors Jellby Calibre 1 04-01-2013 11:34 AM
Splitting the Bible into Multiple Files SciFiGal777 Ectaco jetBook 3 03-27-2010 09:35 PM


All times are GMT -4. The time now is 08:13 AM.


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