Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 04-26-2022, 06:05 PM   #1
C8H10N4O2
Member
C8H10N4O2 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Mar 2013
Device: iPad 3, Kindle DX
regex to find words in ALL CAPITAL letters

I've been looking for a search that will return all books in my library that have at least one work that is in all capital letters. My current iteration of this is
Code:
title:"~\w[A-Z]+(?:\s+[A-Z]+)*\w"
. I have also tried
Code:
title:"~[A-Z\s]+"
and
Code:
title:"~m/^[^a-z]*$/"
.

None of these are returning what I expect. Can someone help me figure otu what I'm doing wrong?
C8H10N4O2 is offline   Reply With Quote
Old 04-26-2022, 10:04 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
title:~\b[A-Z]+\b
kovidgoyal is offline   Reply With Quote
Advert
Old 04-26-2022, 11:06 PM   #3
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,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
That didn't work here. The help says search is case insensitive. Is that the true for regex searches?
davidfor is offline   Reply With Quote
Old 04-26-2022, 11:26 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
prefix the pattern with (?-i) should remove case-insensitivity
kovidgoyal is offline   Reply With Quote
Old 04-26-2022, 11:43 PM   #5
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,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
That did not find anything. To be clear, what I am using is:

Code:
title:~(?-i)\b[A-Z]+\b
And for test cases, I have books with titles "EXTRA Chapters.kepub" and "ToC WITH Some Anchors".
davidfor is offline   Reply With Quote
Advert
Old 04-27-2022, 01:19 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
set case sensitive searching in Preferences->searching, the use the expression


title:~\b[A-Z]{2,}\b


which will find all titles that have all caps words of length at least 2 letters.
kovidgoyal is offline   Reply With Quote
Old 04-27-2022, 09:46 AM   #7
C8H10N4O2
Member
C8H10N4O2 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Mar 2013
Device: iPad 3, Kindle DX
The update to the settings solved it for me.

That does bring up an interesting question, though... If a user is performing a regex search and specifying that they are looking for a very specific pattern (like this one), should the case preference still apply? I would almost think that, if a user were searching using regex, their search input should override the preferences. Most people wouldn't be using regex if they didn't have a bit of a clue about how it works.

All of my initial test searches above all work once the preference is updated.

What do you think?
C8H10N4O2 is offline   Reply With Quote
Old 04-27-2022, 08:35 PM   #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,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I don't think so. It would basically means that calibre needs to be able to read minds. For your example, it probably makes sense. But, if the I was searching for "aa", how does it know whether I want lowercase only rather than case insensitive.

For me, the ability to turn on or off the case sensitivity should be easier to get to. I am used to the search in the editor where there is a checkbox to enable a case sensitive search. The problem is that I can't see how to add this here. And I am not sure it is something that would be changed frequently enough to make it worthwhile. As this is the first time I can remember the subject coming up, maybe it isn't.
davidfor is offline   Reply With Quote
Old 05-02-2022, 09:33 AM   #9
C8H10N4O2
Member
C8H10N4O2 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Mar 2013
Device: iPad 3, Kindle DX
I can understand where you are coming from, but on the flip side, when someone is using regex to search, I feel like they would expect it to perform exactly as specified in the query. I can understand overriding when doing regular text searching, but regex should intrinsically allow more control.

Now that I know to turn the option on/off, it isn't such a big deal.
C8H10N4O2 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex to find small letter followed by capital? Vortex Library Management 2 03-18-2016 06:16 AM
Nicknames - capital vs. small letters bordovy Lounge 41 07-27-2015 07:27 PM
Help with Regex - find groups of words in uppercase Hoods7070 Sigil 3 06-11-2013 08:41 AM
Chapters are just All Capital letters kevn57 Conversion 4 01-18-2012 07:42 PM


All times are GMT -4. The time now is 09:10 AM.


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