Quote:
Originally Posted by Wiggo
After many years I finally dared to install JS (Calibre 6.14.1, JS 1.0.225). I was always a little afraid of it.
Extracting original title
Code:
Título original|Titulo original|Original Title|titre original|originaler Titel|Originalausgabe
Many of my books have text like this
Code:
Titel der amerikanischen Originalausgabe:
»A Memory of Light«
Result: Titel Der Amerikanischen
Code:
Titel der englischen Originalausgabe
CONSIDER PHLEBAS
Result:Titel Der Englischen
Code:
Die Originalausgabe erschien unter dem Titel »Shadowheart«
Result: Die Erschien Unter Dem Titel »Shadowheart«
Code:
Titel der Originalausgabe: THE MEMOIRS OF LADY TRENT 1:
A NATURAL HISTORY OF DRAGONS
Result: Titel Der The Memoirs Of Lady Trent 1
Could you expand the extraction to two lines? Then I would only have to delete the unnecessary text
|
Wiggo:
Go here:
https://pythex.org/?regex=Titel%20der%20Originalausgabe%5B%3A%5D(.%2B )%24%7CDie%20Originalausgabe%20erschien%20unter%20 dem%20Titel%20%5B%C2%BB%5D*(.%2B)%5B%C2%AB%5D*%24% 7CTitel%20der%20amerikanischen%20Originalausgabe%3 A%20%5B%C2%BB%5D*(.%2B)%5B%C2%AB%5D*%24&test_strin g=Book%20%231%3A%20%20Titel%20der%20Originalausgab e%3A%20THE%20MEMOIRS%20OF%20LADY%20TRENT%201%3A%0A A%20NATURAL%20HISTORY%20OF%20DRAGONS%0A%0ABook%20% 232%3A%20%20Titel%20der%20amerikanischen%20Origina lausgabe%3A%0A%C2%BBA%20Memory%20of%20Light%C2%AB% 0A%0ABook%20%233%3A%20%20Die%20Originalausgabe%20e rschien%20unter%20dem%20Titel%20%C2%BBShadowheart% C2%AB&ignorecase=1&multiline=0&dotall=1&verbose=0
Which takes you what is shown on the attached image. It is unrealistic in that it is 3 books in 1, whereas your search will be 1 book at a time. It is meant to be educational for you.
Note the "IGNORECASE" plus the "DOTALL".
EPOM can easily do this.
JS's regex search assumes MULTILINE, and not DOTALL.
EPOM lets you use whatever you want.
Added: You might want to change the [»]*(.+)[«]* to be [»](.+)[«] instead after you learn what the * does by reading the Cheat-sheet at the bottom of Pythex. The second value is highly specific to your example.
DaltonST