![]() |
#1 |
Member
![]() Posts: 15
Karma: 10
Join Date: Mar 2019
Location: Hamburg/Germany
Device: Kindle Paperwhite 7. Generation
|
need help to create a regex
I have an epub which has tags like this in html
Code:
<body id="CCNA0-13649bfe67614ed3be03405aa6e1ffaf" class="calibre"> Code:
<content src="text/part0011.html#AFM60-13649bfe67614ed3be03405aa6e1ffaf"/> Code:
<body class="calibre"> For the second my idea is to replace Code:
html#AFM60-13649bfe67614ed3be03405aa6e1ffaf" Code:
html" |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,592
Karma: 9499994
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Try...
find: <body id=".*?" class="calibre"> replace: <body class="calibre"> find: html#.*?" replace: html" |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
I'd tweak it slightly with a much more narrow:
Find: <body id="[^"]+" class="calibre"> Replace: <body class="calibre"> Find: html#[^"]+"/> Replace: html"/> Those 2 regexes are kind of saying:
It's a little bit safer than .*?, which can sometimes go crazy if you weren't expecting it. ![]() Last edited by Tex2002ans; 05-06-2023 at 07:00 AM. |
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 15
Karma: 10
Join Date: Mar 2019
Location: Hamburg/Germany
Device: Kindle Paperwhite 7. Generation
|
@Karellen
The first one works like a charm. I needed to change the second one to Code:
html#.*" Thank you! ![]() Last edited by Dr.Strangelove; 05-06-2023 at 07:00 AM. |
![]() |
![]() |
![]() |
#5 | |
Member
![]() Posts: 15
Karma: 10
Join Date: Mar 2019
Location: Hamburg/Germany
Device: Kindle Paperwhite 7. Generation
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
pdf regex question - regex that wraps to a new line | flyash | Conversion | 1 | 09-05-2021 09:00 AM |
Predefined regex for Regex-function | sherman | Editor | 3 | 01-19-2020 05:32 AM |
Need help with RegEx | Gary Friedman | Editor | 8 | 01-26-2017 08:37 AM |
Help with some regex | Chaos_Therum | Library Management | 1 | 12-28-2013 11:20 AM |
New help with a regex | txckie | Calibre | 2 | 08-29-2011 08:46 PM |