![]() |
#1 |
Junior Member
![]() Posts: 1
Karma: 10
Join Date: Jan 2021
Device: Kindle
|
Help - Regex code to add parameter to a tag.
Good morning,
I am new in caliber, and when I did my first conversion from azw3 to epub, the text appears in positions that do not correspond, then investigating a little more in the code I have verified that it is missing to add a parameter to a label. Code:
<span class="word si fs5" style="left: 518px; top: 613px; width: 165px; ">COU</span> <span class="word si fs5" style="left: 697px; top: 613px; width: 149px; ">RSE</span> <span class="word si fs6" style="left: 891px; top: 613px; width: 219px; ">BOOK</span> Code:
<span class="word si pos fs5" style="left: 518px; top: 613px; width: 165px; ">COU</span> <span class="word si pos fs5" style="left: 697px; top: 613px; width: 149px; ">RSE</span> <span class="word si pos fs6" style="left: 891px; top: 613px; width: 219px; ">BOOK</span> I started reading the regex examples, and the only thing I could do was this, but I don't achieve the desired result. search : word si([^f]+) replace : \1pos somebody please help me. Greetings. |
![]() |
![]() |
![]() |
#2 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 450
Karma: 3886916
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Kobo Forma
|
Assuming a standard space character between si and fs, I would just try a regular non-regex search:
Search si fs replace si pos fs The chance of other text getting caught in error looks pretty low with that combination. But that looks like it might be a fixed-layout book...good luck. |
![]() |
![]() |
![]() |
#3 |
Book E d i t o r
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
Retiredbiker's solution should work. Here's a Regex solution:
Find: "word si fs([\d]+)" Replace: "word si pos fs\1" |
![]() |
![]() |
![]() |
#4 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,758
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
This is a regular search solution that will work 100%.
Search: <span class="word si fs5" Replace: <span class="word si pos fs5" |
![]() |
![]() |
![]() |
#5 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,220
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Code:
<span class="word si fs5" style="left: 518px; top: 613px; width: 165px; ">COU</span> <span class="word si fs5" style="left: 697px; top: 613px; width: 149px; ">RSE</span> <span class="word si fs6" style="left: 891px; top: 613px; width: 219px; ">BOOK</span> |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regex Beginning and End of Tag | d351r3d | Sigil | 7 | 06-08-2020 11:40 PM |
Regex: grabbing <h3><span> tag group | meghane_e | Editor | 8 | 03-28-2019 04:33 PM |
Why does the [code] tag add an empty line at the end? | DSpider | Feedback | 3 | 06-01-2012 07:34 AM |
restricting regex to single lines of code? | ElMiko | Sigil | 14 | 01-28-2012 04:39 PM |
Help with RegEx - add Year as Tag item | puterdude | Library Management | 0 | 01-20-2012 03:06 PM |