From 5b17f850cd17bae5aee32bc2a7a000cfb6b039ea Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Tue, 7 Jun 2011 15:46:05 +0100 Subject: [PATCH] Add discussion about doubled backslashes for escaping chars in search query regular expressions --- src/calibre/manual/gui.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/manual/gui.rst b/src/calibre/manual/gui.rst index 752c9c4881..f4b04f6e9d 100644 --- a/src/calibre/manual/gui.rst +++ b/src/calibre/manual/gui.rst @@ -326,8 +326,9 @@ Two other kinds of searches are available: equality search and search using regu Equality searches are indicated by prefixing the search string with an equals sign (=). For example, the query ``tag:"=science"`` will match "science", but not "science fiction" or "hard science". Regular expression searches are indicated by prefixing the search string with a tilde (~). Any python-compatible regular expression can -be used. Regular expression searches are contains searches unless the expression contains anchors. -Should you need to search for a string with a leading equals or tilde, prefix the string with a backslash. +be used. Note that backslashes use to escape special characters in reqular expressions must be doubled, because single backslashes will be removed during query parsing. For example, to match a literal parenthesis, you must enter ``\\(``. Regular expression searches are contains searches unless the expression contains anchors. + +Should you need to search for a string with a leading equals or tilde, prefix the string with a backslash. Enclose search strings with quotes (") if the string contains parenthesis or spaces. For example, to search for the tag ``Science Fiction``, you would need to search for ``tag:"=science fiction"``. If you search for