Quote:
Originally Posted by calmeilles
I was trying to search with the regex "[A-Z][A-Z][A-Z]" — looking for 3 consecutive capital letters but the search operated case-insensitive so I was getting results ABC, AbC, abc etc which came as a considerable surprise.
I believe that this is because my install has LOCALE=en_GB and the collate order for that is case insensitive. I may be wrong, but it's my best guess and actually doesn't matter.*
The Regex documentation page includes how to make a case sensitive [which is what we'd normally expect] ignore case with the "(?i)" syntax but not how to do the reverse. It actually turned out quite a chore tracking down what was required and a note in the documentation I feel would be useful.
What I ended up with was
It's the possibility of -i that's missing and was quite obscure even in the Python docs.
(*I am curious if this is true or something else caused it.
If my guess is right then also mentioning that LOCALE can serious affect your regexes would also be useful.)
|
If you are using the calibre ebook editor then all you needed to do was check the box for case sensitive.
bernie