View Single Post
Old 05-11-2015, 05:10 AM   #4
rebl
r.eads e.njoys b.ooks lol
rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.rebl ought to be getting tired of karma fortunes by now.
 
rebl's Avatar
 
Posts: 76
Karma: 580748
Join Date: Mar 2010
Location: It's time to get this Book a Rest
Device: Kindle 4 NT
so how do i search for lowercase authors?

If case sensitive search does not work (calibre 2.27) then how can we search for e.g. authors in lowercase?
I need to do this because I have a few imported books that have the title and author swapped and this is a very easy way of finding them.
I've tried ^[a-z] or even ^m as a test and it returns all authors or, respectivelly or authors starting with M.

Edit:
Unfortunatelly, the solution posted by silentgy does not appear to work either.

{author:switch(^[a-z], az, )} by which I was trying to identify lowercase authors fills the column for all books with "az" even for the authors who's names start with [A-Z]

also confirmed here:
http://manual.calibre-ebook.com/template_lang.html
Many functions use regular expressions. In all cases, regular expression matching is case-insensitive.

edit2: ok there are a few functions that can work for what I'm trying; I will also test with re()

edit3: there is another problem with re() - the manual give two versions of the syntax (with 2 or 3 arguments) and only the 2 version is correct

Here (http://manual.calibre-ebook.com/temp...rn-replacement) the syntax is described as:
re(val, pattern, replacement) – return the field after applying the regular expression. All instances of pattern are replaced with replacement. As in all of calibre, these are python-compatible regular expressions

but here (http://manual.calibre-ebook.com/template_lang.html)
is:
re(pattern, replacement) – return the field after applying the regular expression. All instances of pattern are replaced with replacement. As in all of calibre, these are python-compatible regular expressions.

I know I have an auther named e.g. "time" (with no quotes).
first version (with three arguments) outputs a template error (incorrect number of arguments)
i've tried with {author:re(^t, t, zzz)} and with {author:re(^[a-z], az, zzz)}
second version {author:re(^t, t)} just copies all the authors in the custom column
(because it replaces T or t with T or t)
while {author:re(^[a-z], az, zzz)} replaces any first character with az but it is not case sensitive

so... no case sensitive search by no means?

Last edited by rebl; 05-11-2015 at 05:54 AM.
rebl is offline   Reply With Quote