![]() |
#1 |
Member
![]() 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" Code:
title:"~[A-Z\s]+" Code:
title:"~m/^[^a-z]*$/" None of these are returning what I expect. Can someone help me figure otu what I'm doing wrong? |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
title:~\b[A-Z]+\b
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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?
|
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
prefix the pattern with (?-i) should remove case-insensitivity
|
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#7 |
Member
![]() 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? |
![]() |
![]() |
![]() |
#8 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#9 |
Member
![]() 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. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |