| 1 |
# SOME DESCRIPTIVE TITLE. |
| 2 |
# Copyright (C) Kovid Goyal |
| 3 |
# This file is distributed under the same license as the calibre package. |
| 4 |
# |
| 5 |
# Translators: |
| 6 |
msgid "" |
| 7 |
msgstr "" |
| 8 |
"Project-Id-Version: calibre\n" |
| 9 |
"Report-Msgid-Bugs-To: \n" |
| 10 |
"POT-Creation-Date: 2022-08-10 17:06+0000\n" |
| 11 |
"PO-Revision-Date: 2014-06-17 08:35+0000\n" |
| 12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 13 |
"Language-Team: Malayalam (http://www.transifex.com/calibre/calibre/language/ml/)\n" |
| 14 |
"MIME-Version: 1.0\n" |
| 15 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 16 |
"Content-Transfer-Encoding: 8bit\n" |
| 17 |
"Language: ml\n" |
| 18 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
| 19 |
|
| 20 |
#: ../../__w/calibre/calibre/manual/regexp.rst:4 |
| 21 |
msgid "All about using regular expressions in calibre" |
| 22 |
msgstr "" |
| 23 |
|
| 24 |
#: ../../__w/calibre/calibre/manual/regexp.rst:6 |
| 25 |
msgid "" |
| 26 |
"Regular expressions are features used in many places in calibre to perform " |
| 27 |
"sophisticated manipulation of e-book content and metadata. This tutorial is " |
| 28 |
"a gentle introduction to getting you started with using regular expressions " |
| 29 |
"in calibre." |
| 30 |
msgstr "" |
| 31 |
|
| 32 |
#: ../../__w/calibre/calibre/manual/regexp.rst:11 |
| 33 |
msgid "Contents" |
| 34 |
msgstr "" |
| 35 |
|
| 36 |
#: ../../__w/calibre/calibre/manual/regexp.rst:14 |
| 37 |
msgid "First, a word of warning and a word of courage" |
| 38 |
msgstr "" |
| 39 |
|
| 40 |
#: ../../__w/calibre/calibre/manual/regexp.rst:16 |
| 41 |
msgid "" |
| 42 |
"This is, inevitably, going to be somewhat technical- after all, regular " |
| 43 |
"expressions are a technical tool for doing technical stuff. I'm going to " |
| 44 |
"have to use some jargon and concepts that may seem complicated or " |
| 45 |
"convoluted. I'm going to try to explain those concepts as clearly as I can, " |
| 46 |
"but really can't do without using them at all. That being said, don't be " |
| 47 |
"discouraged by any jargon, as I've tried to explain everything new. And " |
| 48 |
"while regular expressions themselves may seem like an arcane, black magic " |
| 49 |
"(or, to be more prosaic, a random string of mumbo-jumbo letters and signs), " |
| 50 |
"I promise that they are not all that complicated. Even those who understand " |
| 51 |
"regular expressions really well have trouble reading the more complex ones, " |
| 52 |
"but writing them isn't as difficult- you construct the expression step by " |
| 53 |
"step. So, take a step and follow me into the rabbit hole." |
| 54 |
msgstr "" |
| 55 |
|
| 56 |
#: ../../__w/calibre/calibre/manual/regexp.rst:19 |
| 57 |
msgid "Where in calibre can you use regular expressions?" |
| 58 |
msgstr "" |
| 59 |
|
| 60 |
#: ../../__w/calibre/calibre/manual/regexp.rst:21 |
| 61 |
msgid "" |
| 62 |
"There are a few places calibre uses regular expressions. There's the " |
| 63 |
":guilabel:`Search & replace` in conversion options, metadata detection from " |
| 64 |
"filenames in the import settings and Search & replace when editing the " |
| 65 |
"metadata of books in bulk. The calibre book editor can also use regular " |
| 66 |
"expressions in its :guilabel:`Search and replace` feature. Finally, you can " |
| 67 |
"use regular expressions when searching the calibre book list and when " |
| 68 |
"searching inside the calibre E-book viewer." |
| 69 |
msgstr "" |
| 70 |
|
| 71 |
#: ../../__w/calibre/calibre/manual/regexp.rst:30 |
| 72 |
msgid "What on earth *is* a regular expression?" |
| 73 |
msgstr "" |
| 74 |
|
| 75 |
#: ../../__w/calibre/calibre/manual/regexp.rst:32 |
| 76 |
msgid "" |
| 77 |
"A regular expression is a way to describe sets of strings. A single regular " |
| 78 |
"expression can *match* a number of different strings. This is what makes " |
| 79 |
"regular expression so powerful -- they are a concise way of describing a " |
| 80 |
"potentially large number of variations." |
| 81 |
msgstr "" |
| 82 |
|
| 83 |
#: ../../__w/calibre/calibre/manual/regexp.rst:34 |
| 84 |
msgid "" |
| 85 |
"I'm using string here in the sense it is used in programming languages: a " |
| 86 |
"string of one or more characters, characters including actual characters, " |
| 87 |
"numbers, punctuation and so-called whitespace (linebreaks, tabulators etc.)." |
| 88 |
" Please note that generally, uppercase and lowercase characters are not " |
| 89 |
"considered the same, thus \"a\" being a different character from \"A\" and " |
| 90 |
"so forth. In calibre, regular expressions are case insensitive in the Search" |
| 91 |
" bar, but not in the conversion options. There's a way to make every regular" |
| 92 |
" expression case insensitive, but we'll discuss that later. It gets " |
| 93 |
"complicated because regular expressions allow for variations in the strings " |
| 94 |
"it matches, so one expression can match multiple strings, which is why " |
| 95 |
"people bother using them at all. More on that in a bit." |
| 96 |
msgstr "" |
| 97 |
|
| 98 |
#: ../../__w/calibre/calibre/manual/regexp.rst:37 |
| 99 |
msgid "Care to explain?" |
| 100 |
msgstr "" |
| 101 |
|
| 102 |
#: ../../__w/calibre/calibre/manual/regexp.rst:39 |
| 103 |
msgid "" |
| 104 |
"Well, that's why we're here. First, this is the most important concept in " |
| 105 |
"regular expressions: *A string by itself is a regular expression that " |
| 106 |
"matches itself*. That is to say, if I wanted to match the string ``\"Hello, " |
| 107 |
"World!\"`` using a regular expression, the regular expression to use would " |
| 108 |
"be ``Hello, World!``. And yes, it really is that simple. You'll notice, " |
| 109 |
"though, that this *only* matches the exact string ``\"Hello, World!\"``, not" |
| 110 |
" e.g. ``\"Hello, wOrld!\"`` or ``\"hello, world!\"`` or any other such " |
| 111 |
"variation." |
| 112 |
msgstr "" |
| 113 |
|
| 114 |
#: ../../__w/calibre/calibre/manual/regexp.rst:42 |
| 115 |
msgid "That doesn't sound too bad. What's next?" |
| 116 |
msgstr "" |
| 117 |
|
| 118 |
#: ../../__w/calibre/calibre/manual/regexp.rst:44 |
| 119 |
msgid "" |
| 120 |
"Next is the beginning of the really good stuff. Remember where I said that " |
| 121 |
"regular expressions can match multiple strings? This is where it gets a " |
| 122 |
"little more complicated. Say, as a somewhat more practical exercise, the " |
| 123 |
"e-book you wanted to convert had a nasty footer counting the pages, like " |
| 124 |
"\"Page 5 of 423\". Obviously the page number would rise from 1 to 423, thus " |
| 125 |
"you'd have to match 423 different strings, right? Wrong, actually: regular " |
| 126 |
"expressions allow you to define sets of characters that are matched: To " |
| 127 |
"define a set, you put all the characters you want to be in the set into " |
| 128 |
"square brackets. So, for example, the set ``[abc]`` would match either the " |
| 129 |
"character \"a\", \"b\" or \"c\". *Sets will always only match one of the " |
| 130 |
"characters in the set*. They \"understand\" character ranges, that is, if " |
| 131 |
"you wanted to match all the lower case characters, you'd use the set " |
| 132 |
"``[a-z]`` for lower- and uppercase characters you'd use ``[a-zA-Z]`` and so " |
| 133 |
"on. Got the idea? So, obviously, using the expression ``Page [0-9] of 423`` " |
| 134 |
"you'd be able to match the first 9 pages, thus reducing the expressions " |
| 135 |
"needed to three: The second expression ``Page [0-9][0-9] of 423`` would " |
| 136 |
"match all two-digit page numbers, and I'm sure you can guess what the third " |
| 137 |
"expression would look like. Yes, go ahead. Write it down." |
| 138 |
msgstr "" |
| 139 |
|
| 140 |
#: ../../__w/calibre/calibre/manual/regexp.rst:47 |
| 141 |
msgid "Hey, neat! This is starting to make sense!" |
| 142 |
msgstr "" |
| 143 |
|
| 144 |
#: ../../__w/calibre/calibre/manual/regexp.rst:49 |
| 145 |
msgid "" |
| 146 |
"I was hoping you'd say that. But brace yourself, now it gets even better! We" |
| 147 |
" just saw that using sets, we could match one of several characters at once." |
| 148 |
" But you can even repeat a character or set, reducing the number of " |
| 149 |
"expressions needed to handle the above page number example to one. Yes, ONE!" |
| 150 |
" Excited? You should be! It works like this: Some so-called special " |
| 151 |
"characters, \"+\", \"?\" and \"*\", *repeat the single element preceding " |
| 152 |
"them*. (Element means either a single character, a character set, an escape " |
| 153 |
"sequence or a group (we'll learn about those last two later)- in short, any " |
| 154 |
"single entity in a regular expression). These characters are called " |
| 155 |
"wildcards or quantifiers. To be more precise, \"?\" matches *0 or 1* of the " |
| 156 |
"preceding element, \"*\" matches *0 or more* of the preceding element and " |
| 157 |
"\"+\" matches *1 or more* of the preceding element. A few examples: The " |
| 158 |
"expression ``a?`` would match either \"\" (which is the empty string, not " |
| 159 |
"strictly useful in this case) or \"a\", the expression ``a*`` would match " |
| 160 |
"\"\", \"a\", \"aa\" or any number of a's in a row, and, finally, the " |
| 161 |
"expression ``a+`` would match \"a\", \"aa\" or any number of a's in a row " |
| 162 |
"(Note: it wouldn't match the empty string!). Same deal for sets: The " |
| 163 |
"expression ``[0-9]+`` would match *every integer number there is*! I know " |
| 164 |
"what you're thinking, and you're right: If you use that in the above case of" |
| 165 |
" matching page numbers, wouldn't that be the single one expression to match " |
| 166 |
"all the page numbers? Yes, the expression ``Page [0-9]+ of 423`` would match" |
| 167 |
" every page number in that book!" |
| 168 |
msgstr "" |
| 169 |
|
| 170 |
#: ../../__w/calibre/calibre/manual/regexp.rst:52 |
| 171 |
msgid "" |
| 172 |
"A note on these quantifiers: They generally try to match as much text as " |
| 173 |
"possible, so be careful when using them. This is called \"greedy " |
| 174 |
"behaviour\"- I'm sure you get why. It gets problematic when you, say, try to" |
| 175 |
" match a tag. Consider, for example, the string ``\"<p " |
| 176 |
"class=\"calibre2\">Title here</p>\"`` and let's say you'd want to match the " |
| 177 |
"opening tag (the part between the first pair of angle brackets, a little " |
| 178 |
"more on tags later). You'd think that the expression ``<p.*>`` would match " |
| 179 |
"that tag, but actually, it matches the whole string! (The character \".\" is" |
| 180 |
" another special character. It matches anything *except* linebreaks, so, " |
| 181 |
"basically, the expression ``.*`` would match any single line you can think " |
| 182 |
"of). Instead, try using ``<p.*?>`` which makes the quantifier ``\"*\"`` non-" |
| 183 |
"greedy. That expression would only match the first opening tag, as intended." |
| 184 |
" There's actually another way to accomplish this: The expression " |
| 185 |
"``<p[^>]*>`` will match that same opening tag- you'll see why after the next" |
| 186 |
" section. Just note that there quite frequently is more than one way to " |
| 187 |
"write a regular expression." |
| 188 |
msgstr "" |
| 189 |
|
| 190 |
#: ../../__w/calibre/calibre/manual/regexp.rst:56 |
| 191 |
msgid "" |
| 192 |
"Well, these special characters are very neat and all, but what if I wanted " |
| 193 |
"to match a dot or a question mark?" |
| 194 |
msgstr "" |
| 195 |
|
| 196 |
#: ../../__w/calibre/calibre/manual/regexp.rst:58 |
| 197 |
msgid "" |
| 198 |
"You can of course do that: Just put a backslash in front of any special " |
| 199 |
"character and it is interpreted as the literal character, without any " |
| 200 |
"special meaning. This pair of a backslash followed by a single character is " |
| 201 |
"called an escape sequence, and the act of putting a backslash in front of a " |
| 202 |
"special character is called escaping that character. An escape sequence is " |
| 203 |
"interpreted as a single element. There are of course escape sequences that " |
| 204 |
"do more than just escaping special characters, for example ``\"\\t\"`` means" |
| 205 |
" a tabulator. We'll get to some of the escape sequences later. Oh, and by " |
| 206 |
"the way, concerning those special characters: Consider any character we " |
| 207 |
"discuss in this introduction as having some function to be special and thus " |
| 208 |
"needing to be escaped if you want the literal character." |
| 209 |
msgstr "" |
| 210 |
|
| 211 |
#: ../../__w/calibre/calibre/manual/regexp.rst:61 |
| 212 |
msgid "So, what are the most useful sets?" |
| 213 |
msgstr "" |
| 214 |
|
| 215 |
#: ../../__w/calibre/calibre/manual/regexp.rst:63 |
| 216 |
msgid "" |
| 217 |
"Knew you'd ask. Some useful sets are ``[0-9]`` matching a single number, " |
| 218 |
"``[a-z]`` matching a single lowercase letter, ``[A-Z]`` matching a single " |
| 219 |
"uppercase letter, ``[a-zA-Z]`` matching a single letter and ``[a-zA-Z0-9]`` " |
| 220 |
"matching a single letter or number. You can also use an escape sequence as " |
| 221 |
"shorthand:" |
| 222 |
msgstr "" |
| 223 |
|
| 224 |
#: ../../__w/calibre/calibre/manual/regexp.rst:70 |
| 225 |
msgid "``\\d``" |
| 226 |
msgstr "" |
| 227 |
|
| 228 |
#: ../../__w/calibre/calibre/manual/regexp.rst:70 |
| 229 |
msgid "is equivalent to ``[0-9]``" |
| 230 |
msgstr "" |
| 231 |
|
| 232 |
#: ../../__w/calibre/calibre/manual/regexp.rst:74 |
| 233 |
msgid "``\\w``" |
| 234 |
msgstr "" |
| 235 |
|
| 236 |
#: ../../__w/calibre/calibre/manual/regexp.rst:73 |
| 237 |
msgid "is equivalent to ``[a-zA-Z0-9_]``" |
| 238 |
msgstr "" |
| 239 |
|
| 240 |
#: ../../__w/calibre/calibre/manual/regexp.rst:77 |
| 241 |
msgid "``\\s``" |
| 242 |
msgstr "" |
| 243 |
|
| 244 |
#: ../../__w/calibre/calibre/manual/regexp.rst:77 |
| 245 |
msgid "is equivalent to any whitespace" |
| 246 |
msgstr "" |
| 247 |
|
| 248 |
#: ../../__w/calibre/calibre/manual/regexp.rst:80 |
| 249 |
msgid "" |
| 250 |
"\"Whitespace\" is a term for anything that won't be printed. These " |
| 251 |
"characters include space, tabulator, line feed, form feed, carriage return, " |
| 252 |
"non-breaking spaces, etc." |
| 253 |
msgstr "" |
| 254 |
|
| 255 |
#: ../../__w/calibre/calibre/manual/regexp.rst:83 |
| 256 |
msgid "" |
| 257 |
"The upper and lower case sets may match both upper and lowercase if the " |
| 258 |
"setting to make searches case insensitive is enabled. Such settings are " |
| 259 |
"found, for instance in Preferences->Searching in calibre itself and on the " |
| 260 |
"Search panel in the calibre :guilabel:`E-book viewer` as well as the calibre" |
| 261 |
" :guilabel:`Edit book` tool." |
| 262 |
msgstr "" |
| 263 |
|
| 264 |
#: ../../__w/calibre/calibre/manual/regexp.rst:89 |
| 265 |
msgid "" |
| 266 |
"As a last note on sets, you can also define a set as any character *but* " |
| 267 |
"those in the set. You do that by including the character ``\"^\"`` as the " |
| 268 |
"*very first character in the set*. Thus, ``[^a]`` would match any character " |
| 269 |
"excluding \"a\". That's called complementing the set. Those escape sequence " |
| 270 |
"shorthands we saw earlier can also be complemented: ``\"\\D\"`` means any " |
| 271 |
"non-number character, thus being equivalent to ``[^0-9]``. The other " |
| 272 |
"shorthands can be complemented by, you guessed it, using the respective " |
| 273 |
"uppercase letter instead of the lowercase one. So, going back to the example" |
| 274 |
" ``<p[^>]*>`` from the previous section, now you can see that the character " |
| 275 |
"set it's using tries to match any character except for a closing angle " |
| 276 |
"bracket." |
| 277 |
msgstr "" |
| 278 |
|
| 279 |
#: ../../__w/calibre/calibre/manual/regexp.rst:94 |
| 280 |
msgid "" |
| 281 |
"But if I had a few varying strings I wanted to match, things get " |
| 282 |
"complicated?" |
| 283 |
msgstr "" |
| 284 |
|
| 285 |
#: ../../__w/calibre/calibre/manual/regexp.rst:96 |
| 286 |
msgid "" |
| 287 |
"Fear not, life still is good and easy. Consider this example: The book " |
| 288 |
"you're converting has \"Title\" written on every odd page and \"Author\" " |
| 289 |
"written on every even page. Looks great in print, right? But in e-books, " |
| 290 |
"it's annoying. You can group whole expressions in normal parentheses, and " |
| 291 |
"the character ``\"|\"`` will let you match *either* the expression to its " |
| 292 |
"right *or* the one to its left. Combine those and you're done. Too fast for " |
| 293 |
"you? Okay, first off, we group the expressions for odd and even pages, thus " |
| 294 |
"getting ``(Title)(Author)`` as our two needed expressions. Now we make " |
| 295 |
"things simpler by using the vertical bar (``\"|\"`` is called the vertical " |
| 296 |
"bar character): If you use the expression ``(Title|Author)`` you'll either " |
| 297 |
"get a match for \"Title\" (on the odd pages) or you'd match \"Author\" (on " |
| 298 |
"the even pages). Well, wasn't that easy?" |
| 299 |
msgstr "" |
| 300 |
|
| 301 |
#: ../../__w/calibre/calibre/manual/regexp.rst:98 |
| 302 |
msgid "" |
| 303 |
"You can, of course, use the vertical bar without using grouping parentheses," |
| 304 |
" as well. Remember when I said that quantifiers repeat the element preceding" |
| 305 |
" them? Well, the vertical bar works a little differently: The expression " |
| 306 |
"\"Title|Author\" will also match either the string \"Title\" or the string " |
| 307 |
"\"Author\", just as the above example using grouping. *The vertical bar " |
| 308 |
"selects between the entire expression preceding and following it*. So, if " |
| 309 |
"you wanted to match the strings \"Calibre\" and \"calibre\" and wanted to " |
| 310 |
"select only between the upper- and lowercase \"c\", you'd have to use the " |
| 311 |
"expression ``(c|C)alibre``, where the grouping ensures that only the \"c\" " |
| 312 |
"will be selected. If you were to use ``c|Calibre``, you'd get a match on the" |
| 313 |
" string \"c\" or on the string \"Calibre\", which isn't what we wanted. In " |
| 314 |
"short: If in doubt, use grouping together with the vertical bar." |
| 315 |
msgstr "" |
| 316 |
|
| 317 |
#: ../../__w/calibre/calibre/manual/regexp.rst:101 |
| 318 |
msgid "You missed..." |
| 319 |
msgstr "" |
| 320 |
|
| 321 |
#: ../../__w/calibre/calibre/manual/regexp.rst:103 |
| 322 |
msgid "" |
| 323 |
"... wait just a minute, there's one last, really neat thing you can do with " |
| 324 |
"groups. If you have a group that you previously matched, you can use " |
| 325 |
"references to that group later in the expression: Groups are numbered " |
| 326 |
"starting with 1, and you reference them by escaping the number of the group " |
| 327 |
"you want to reference, thus, the fifth group would be referenced as ``\\5``." |
| 328 |
" So, if you searched for ``([^ ]+) \\1`` in the string \"Test Test\", you'd " |
| 329 |
"match the whole string!" |
| 330 |
msgstr "" |
| 331 |
|
| 332 |
#: ../../__w/calibre/calibre/manual/regexp.rst:107 |
| 333 |
msgid "" |
| 334 |
"In the beginning, you said there was a way to make a regular expression case" |
| 335 |
" insensitive?" |
| 336 |
msgstr "" |
| 337 |
|
| 338 |
#: ../../__w/calibre/calibre/manual/regexp.rst:109 |
| 339 |
msgid "" |
| 340 |
"Yes, I did, thanks for paying attention and reminding me. You can tell " |
| 341 |
"calibre how you want certain things handled by using something called flags." |
| 342 |
" You include flags in your expression by using the special construct " |
| 343 |
"``(?flags go here)`` where, obviously, you'd replace \"flags go here\" with " |
| 344 |
"the specific flags you want. For ignoring case, the flag is ``i``, thus you " |
| 345 |
"include ``(?i)`` in your expression. Thus, ``(?i)test`` would match " |
| 346 |
"\"Test\", \"tEst\", \"TEst\" and any case variation you could think of." |
| 347 |
msgstr "" |
| 348 |
|
| 349 |
#: ../../__w/calibre/calibre/manual/regexp.rst:111 |
| 350 |
msgid "" |
| 351 |
"Another useful flag lets the dot match any character at all, *including* the" |
| 352 |
" newline, the flag ``s``. If you want to use multiple flags in an " |
| 353 |
"expression, just put them in the same statement: ``(?is)`` would ignore case" |
| 354 |
" and make the dot match all. It doesn't matter which flag you state first, " |
| 355 |
"``(?si)`` would be equivalent to the above." |
| 356 |
msgstr "" |
| 357 |
|
| 358 |
#: ../../__w/calibre/calibre/manual/regexp.rst:114 |
| 359 |
msgid "" |
| 360 |
"I think I'm beginning to understand these regular expressions now... how do " |
| 361 |
"I use them in calibre?" |
| 362 |
msgstr "" |
| 363 |
|
| 364 |
#: ../../__w/calibre/calibre/manual/regexp.rst:117 |
| 365 |
msgid "Conversions" |
| 366 |
msgstr "" |
| 367 |
|
| 368 |
#: ../../__w/calibre/calibre/manual/regexp.rst:119 |
| 369 |
msgid "" |
| 370 |
"Let's begin with the conversion settings, which is really neat. In the " |
| 371 |
":guilabel:`Search & replace` part, you can input a regexp (short for regular" |
| 372 |
" expression) that describes the string that will be replaced during the " |
| 373 |
"conversion. The neat part is the wizard. Click on the wizard staff and you " |
| 374 |
"get a preview of what calibre \"sees\" during the conversion process. Scroll" |
| 375 |
" down to the string you want to remove, select and copy it, paste it into " |
| 376 |
"the regexp field on top of the window. If there are variable parts, like " |
| 377 |
"page numbers or so, use sets and quantifiers to cover those, and while " |
| 378 |
"you're at it, remember to escape special characters, if there are some. Hit " |
| 379 |
"the button labeled :guilabel:`Test` and calibre highlights the parts it " |
| 380 |
"would replace were you to use the regexp. Once you're satisfied, hit OK and " |
| 381 |
"convert. Be careful if your conversion source has tags like this example::" |
| 382 |
msgstr "" |
| 383 |
|
| 384 |
#: ../../__w/calibre/calibre/manual/regexp.rst:129 |
| 385 |
msgid "" |
| 386 |
"(shamelessly ripped out of `this thread " |
| 387 |
"<https://www.mobileread.com/forums/showthread.php?t=75594\">`_). You'd have " |
| 388 |
"to remove some of the tags as well. In this example, I'd recommend beginning" |
| 389 |
" with the tag ``<b class=\"calibre2\">``, now you have to end with the " |
| 390 |
"corresponding closing tag (opening tags are ``<tag>``, closing tags are " |
| 391 |
"``</tag>``), which is simply the next ``</b>`` in this case. (Refer to a " |
| 392 |
"good HTML manual or ask in the forum if you are unclear on this point). The " |
| 393 |
"opening tag can be described using ``<b.*?>``, the closing tag using " |
| 394 |
"``</b>``, thus we could remove everything between those tags using " |
| 395 |
"``<b.*?>.*?</b>``. But using this expression would be a bad idea, because it" |
| 396 |
" removes everything enclosed by <b>- tags (which, by the way, render the " |
| 397 |
"enclosed text in bold print), and it's a fair bet that we'll remove portions" |
| 398 |
" of the book in this way. Instead, include the beginning of the enclosed " |
| 399 |
"string as well, making the regular expression " |
| 400 |
"``<b.*?>\\s*Generated\\s+by\\s+ABC\\s+Amber\\s+LIT.*?</b>`` The ``\\s`` with" |
| 401 |
" quantifiers are included here instead of explicitly using the spaces as " |
| 402 |
"seen in the string to catch any variations of the string that might occur. " |
| 403 |
"Remember to check what calibre will remove to make sure you don't remove any" |
| 404 |
" portions you want to keep if you test a new expression. If you only check " |
| 405 |
"one occurrence, you might miss a mismatch somewhere else in the text. Also " |
| 406 |
"note that should you accidentally remove more or fewer tags than you " |
| 407 |
"actually wanted to, calibre tries to repair the damaged code after doing the" |
| 408 |
" removal." |
| 409 |
msgstr "" |
| 410 |
|
| 411 |
#: ../../__w/calibre/calibre/manual/regexp.rst:132 |
| 412 |
msgid "Adding books" |
| 413 |
msgstr "പുസ്തകങ്ങൾ ചേർക്കുന്നു" |
| 414 |
|
| 415 |
#: ../../__w/calibre/calibre/manual/regexp.rst:134 |
| 416 |
msgid "" |
| 417 |
"Another thing you can use regular expressions for is to extract metadata " |
| 418 |
"from filenames. You can find this feature in the \"Adding books\" part of " |
| 419 |
"the settings. There's a special feature here: You can use field names for " |
| 420 |
"metadata fields, for example ``(?P<title>)`` would indicate that calibre " |
| 421 |
"uses this part of the string as book title. The allowed field names are " |
| 422 |
"listed in the windows, together with another nice test field. An example: " |
| 423 |
"Say you want to import a whole bunch of files named like ``Classical Texts: " |
| 424 |
"The Divine Comedy by Dante Alighieri.mobi``. (Obviously, this is already in " |
| 425 |
"your library, since we all love classical italian poetry) or ``Science " |
| 426 |
"Fiction epics: The Foundation Trilogy by Isaac Asimov.epub``. This is " |
| 427 |
"obviously a naming scheme that calibre won't extract any meaningful data out" |
| 428 |
" of - its standard expression for extracting metadata is ``(?P<title>.+) - " |
| 429 |
"(?P<author>[^_]+)``. A regular expression that works here would be " |
| 430 |
"``[a-zA-Z]+: (?P<title>.+) by (?P<author>.+)``. Please note that, inside the" |
| 431 |
" group for the metadata field, you need to use expressions to describe what " |
| 432 |
"the field actually matches. And also note that, when using the test field " |
| 433 |
"calibre provides, you need to add the file extension to your testing " |
| 434 |
"filename, otherwise you won't get any matches at all, despite using a " |
| 435 |
"working expression." |
| 436 |
msgstr "" |
| 437 |
|
| 438 |
#: ../../__w/calibre/calibre/manual/regexp.rst:138 |
| 439 |
msgid "Bulk editing metadata" |
| 440 |
msgstr "" |
| 441 |
|
| 442 |
#: ../../__w/calibre/calibre/manual/regexp.rst:140 |
| 443 |
msgid "" |
| 444 |
"The last part is regular expression :guilabel:`Search and replace` in " |
| 445 |
"metadata fields. You can access this by selecting multiple books in the " |
| 446 |
"library and using bulk metadata edit. Be very careful when using this last " |
| 447 |
"feature, as it can do **Very Bad Things** to your library! Doublecheck that " |
| 448 |
"your expressions do what you want them to using the test fields, and only " |
| 449 |
"mark the books you really want to change! In the regular expression search " |
| 450 |
"mode, you can search in one field, replace the text with something and even " |
| 451 |
"write the result into another field. A practical example: Say your library " |
| 452 |
"contained the books of Frank Herbert's Dune series, named after the fashion " |
| 453 |
"``Dune 1 - Dune``, ``Dune 2 - Dune Messiah`` and so on. Now you want to get " |
| 454 |
"``Dune`` into the series field. You can do that by searching for ``(.*?) " |
| 455 |
"\\d+ - .*`` in the title field and replacing it with ``\\1`` in the series " |
| 456 |
"field. See what I did there? That's a reference to the first group you're " |
| 457 |
"replacing the series field with. Now that you have the series all set, you " |
| 458 |
"only need to do another search for ``.*? -`` in the title field and replace " |
| 459 |
"it with ``\"\"`` (an empty string), again in the title field, and your " |
| 460 |
"metadata is all neat and tidy. Isn't that great? By the way, instead of " |
| 461 |
"replacing the entire field, you can also append or prepend to the field, so," |
| 462 |
" if you *wanted* the book title to be prepended with series info, you could " |
| 463 |
"do that as well. As you by now have undoubtedly noticed, there's a checkbox " |
| 464 |
"labeled :guilabel:`Case sensitive`, so you won't have to use flags to select" |
| 465 |
" behaviour here." |
| 466 |
msgstr "" |
| 467 |
|
| 468 |
#: ../../__w/calibre/calibre/manual/regexp.rst:142 |
| 469 |
msgid "" |
| 470 |
"Well, that just about concludes the very short introduction to regular " |
| 471 |
"expressions. Hopefully I'll have shown you enough to at least get you " |
| 472 |
"started and to enable you to continue learning by yourself- a good starting " |
| 473 |
"point would be the `Python documentation for regexps " |
| 474 |
"<https://docs.python.org/library/re.html>`_." |
| 475 |
msgstr "" |
| 476 |
|
| 477 |
#: ../../__w/calibre/calibre/manual/regexp.rst:144 |
| 478 |
msgid "" |
| 479 |
"One last word of warning, though: Regexps are powerful, but also really easy" |
| 480 |
" to get wrong. calibre provides really great testing possibilities to see if" |
| 481 |
" your expressions behave as you expect them to. Use them. Try not to shoot " |
| 482 |
"yourself in the foot. (God, I love that expression...). But should you, " |
| 483 |
"despite the warning, injure your foot (or any other body parts), try to " |
| 484 |
"learn from it." |
| 485 |
msgstr "" |
| 486 |
|
| 487 |
#: ../../__w/calibre/calibre/manual/regexp.rst:148 |
| 488 |
msgid "Quick reference" |
| 489 |
msgstr "" |
| 490 |
|
| 491 |
#: ../../__w/calibre/calibre/manual/regexp.rst:156 |
| 492 |
msgid "Credits" |
| 493 |
msgstr "" |
| 494 |
|
| 495 |
#: ../../__w/calibre/calibre/manual/regexp.rst:158 |
| 496 |
msgid "Thanks for helping with tips, corrections and such:" |
| 497 |
msgstr "" |
| 498 |
|
| 499 |
#: ../../__w/calibre/calibre/manual/regexp.rst:160 |
| 500 |
msgid "ldolse" |
| 501 |
msgstr "" |
| 502 |
|
| 503 |
#: ../../__w/calibre/calibre/manual/regexp.rst:161 |
| 504 |
msgid "kovidgoyal" |
| 505 |
msgstr "" |
| 506 |
|
| 507 |
#: ../../__w/calibre/calibre/manual/regexp.rst:162 |
| 508 |
msgid "chaley" |
| 509 |
msgstr "" |
| 510 |
|
| 511 |
#: ../../__w/calibre/calibre/manual/regexp.rst:163 |
| 512 |
msgid "dwanthny" |
| 513 |
msgstr "" |
| 514 |
|
| 515 |
#: ../../__w/calibre/calibre/manual/regexp.rst:164 |
| 516 |
msgid "kacir" |
| 517 |
msgstr "" |
| 518 |
|
| 519 |
#: ../../__w/calibre/calibre/manual/regexp.rst:165 |
| 520 |
msgid "Starson17" |
| 521 |
msgstr "" |
| 522 |
|
| 523 |
#: ../../__w/calibre/calibre/manual/regexp.rst:166 |
| 524 |
msgid "Orpheu" |
| 525 |
msgstr "" |
| 526 |
|
| 527 |
#: ../../__w/calibre/calibre/manual/regexp.rst:168 |
| 528 |
msgid "" |
| 529 |
"For more about regexps see `The Python User Manual " |
| 530 |
"<https://docs.python.org/library/re.html>`_. The actual regular expression " |
| 531 |
"library used by calibre is: `regex <https://bitbucket.org/mrabarnett/mrab-" |
| 532 |
"regex/src/hg/>`_ which supports several useful enhancements over the Python " |
| 533 |
"standard library one." |
| 534 |
msgstr "" |