![]() |
#1 |
Member
![]() Posts: 14
Karma: 10
Join Date: Jun 2020
Device: Kindle
|
Regex for replacing class
Hi, can anyone help in replacing this class with nested code inside, throughout multiple documents?
From Code:
<p class="p23"><span id=“ [chapter number] ”></span> [chapter title] </p> Code:
<h1 class="p23"><span id=“ [chapter number] ”></span> [chapter title] </h1> |
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,178
Karma: 8800000
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
|
Quote:
Question does your span id have spaces around the number? Search: Code:
<p class="p(\d+)"><span id=“(\d+)”></span>(.*?)</p> Code:
<h1 class="p23"><span id=“\1”></span>\2</h1> |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,584
Karma: 14328510
Join Date: Nov 2019
Device: none
|
This plugin is designed exactly for that task; no need for regular expressions. Although it does allow you to use them if you want to match multiple classes and such.
https://www.mobileread.com/forums/sh....php?p=2980740 |
![]() |
![]() |
![]() |
#4 | |
Member
![]() Posts: 14
Karma: 10
Join Date: Jun 2020
Device: Kindle
|
Quote:
Make sense? |
|
![]() |
![]() |
![]() |
#5 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,198
Karma: 1355861
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Quote:
Search: Code:
<p class="p23">(.*?)</p> Code:
<h1 class="p23">\1</h1> |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,608
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
You can check this plugin (Diap's Editing toolbag), which does exactly that and other replacements in an easier way.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aura H2O MicroSDHC card class 4 or class 10? | chipro12 | Kobo Reader | 5 | 07-04-2015 02:24 AM |
Replacing with regex | 1v4n0 | Sigil | 11 | 01-17-2015 02:07 PM |
PRS-650 SD Card Importance? SDHC, SDHC Class 4, Class 10 etc is it important | Renji | Sony Reader | 11 | 12-03-2011 12:30 PM |
Replacing code without replacing text? | ElMiko | Sigil | 6 | 11-30-2011 08:14 PM |
Help with regex POSIX class search | bfollowell | Sigil | 7 | 05-21-2011 10:55 AM |