|
|
#1 |
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Dec 2026
Device: xteink x3
|
need help with regex problem
i love using the e-reader xteink because how small and light it is. however it doesn't recognize as many font types as other e-readers like kindle or kobo so for some time already i've been using the regex option in calibre to replace the cursive text from <span class="italic">.*?</span> into <i>\1</i> but for whatever reason when i try to replace it now i get an error window saying IndexError:no such group
i've been searching how to fix this problem or an alternative i can use instead of \1 but can't find anything so i'm hoping someone here can help |
|
|
|
|
|
#2 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,975
Karma: 154365289
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Search: <span class="italic">(.*?)</span> Replace: <i>\1</i> An easier way to do it because spans like this can use different class names, use Otter's Editing Toolbag. It's an editor plugin that's very handy/useful. It easily lets you do what are are trying to do and more. Last edited by JSWolf; Today at 09:48 AM. |
|
|
|
|
|
|
#3 | |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 961
Karma: 2111023
Join Date: Sep 2013
Device: Kobo Sage
|
Quote:
Code:
<span class="italic">(.*?)</span> Last edited by enuddleyarbl; Today at 09:54 AM. |
|
|
|
|
|
|
#4 | ||
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Dec 2026
Device: xteink x3
|
Quote:
Quote:
i didn't even think there was something wrong with the search code because the search itself was working fine and i was getting the error message when i was trying to replace it but you're absolutely right so thanks again |
||
|
|
|
|
|
#5 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 32,075
Karma: 65709392
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
the \1 says put the capture group 1 in this place.
A capture group is indicated by ( ). You can have more than 1. They are numbered in order they are used. Code:
search: (new word 2) will be after (new word 1) Replace: \2 is now correctly ordered \2 |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with .* in regex search | jwes | Sigil | 11 | 06-24-2025 06:32 PM |
| Odd regex problem | jwes | Sigil | 5 | 11-17-2023 09:27 PM |
| Regex problem | John2011 | Sigil | 8 | 01-21-2014 03:12 AM |
| Regex F&R problem? | Jabby | Sigil | 6 | 06-12-2012 05:18 AM |
| Regex Problem | huebi | Sigil | 3 | 05-10-2011 05:32 AM |