![]() |
#631 | ||
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Quote:
![]() Quote:
Yes that is my method although I am making epub3 so my replace is – \1 – Previously I was searching for – (.*) – but very often you can have several dashes in the same paragraph but not the same sentence and as I said, I frequently work on books with hundreds of dashes so the more efficient and refined my search is the better. I search first for a complete set followed by a comma, then complete set no comma, then one dash + comma and then one dash alone. I might be able to combine some of those steps now that I have the more refined search, we'll see. |
||
![]() |
![]() |
![]() |
#632 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Oops, just noticed that my code got eaten... my replace is –# 160 ;\1# 160 ;– only without the spaces, obviously. ![]() Just did a book today with 2313 dashes in it (x_x) so the new and improved regex was greatly appreciated. |
![]() |
![]() |
Advert | |
|
![]() |
#633 |
Unicycle Daredevil
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,944
Karma: 185432100
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD (R.I.P. After six years the USB socket died.) tolino shine 3
|
|
![]() |
![]() |
![]() |
#634 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
![]() Quote:
Code:
–&[ noparse]#160;[/noparse]\1&[ noparse]#160;[/noparse]– – \1 – The forum "helpfully" decides to substitute characters, but in this case, we don't want them, so we tell it "not to parse". ![]() Last edited by Tex2002ans; 04-24-2020 at 04:52 AM. |
||
![]() |
![]() |
![]() |
#635 |
Unicycle Daredevil
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,944
Karma: 185432100
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD (R.I.P. After six years the USB socket died.) tolino shine 3
|
Jeez, even the code tag eats stuff.
![]() |
![]() |
![]() |
Advert | |
|
![]() |
#636 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,664
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
![]() |
![]() |
![]() |
#637 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jul 2015
Device: Kobo Aura HD
|
Hi!
I have 200 ".xhtml" files inside an epub and I need to delete the line 14 of each one of them. Is it possible to do this with Regex? |
![]() |
![]() |
![]() |
#638 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,737
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
|
![]() |
![]() |
![]() |
#639 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,106
Karma: 60406498
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
The simplest is select by the text and replace with 'x' ('x' can be nil ) Can you post the offending ![]() Is it always the same? If not, what part is different? |
|
![]() |
![]() |
![]() |
#640 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 48
Karma: 605108
Join Date: Apr 2016
Device: none
|
If "line 14" means the fourteenth line of code (as opposed to the book's textual content), the regex could be:
Code:
Find: ((?:.*?\R){13}).*?\R Replace: \1 That's a risky operation, since newlines can be easily added or removed by many automatic formatting processes, but if one is absolutely certain that the text between the thirteenth and the fourteenth newline in the code must be deleted (along with the fourteenth newline), that's one way to do it. If, instead, "line 14" is not a reference to the lines of xhtml code, you can ignore this contribution and should provide some meaningful pattern as the others already said. |
![]() |
![]() |
![]() |
#641 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jul 2015
Device: Kobo Aura HD
|
This is what I want to delete (marked as red):
![]() As you can see I have a duplicate title in every file, so what I want is to delete that specific line (14) in all of my xhtml files. |
![]() |
![]() |
![]() |
#642 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,106
Karma: 60406498
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
you can delete the (</h1>)\s+<p>.+?</p>
replace just with the \1 <<I never perfected the use without capture. I just put back the trigger. You can replace the .+? with precise text |
![]() |
![]() |
![]() |
#643 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jul 2015
Device: Kobo Aura HD
|
|
![]() |
![]() |
![]() |
#644 |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Aug 2017
Device: none
|
I want to be able to copy and replace with saved text kond of like how (\d+) saves the number or more than 1 number in a row and then you can output it with \1,\2, etc. Is there a way to do this with all text in between tags. An example would be:
Code:
<p><b>20</b> Words and stuff. Why are there words?<br/><b>20</b> Words and stuff. Why are there words?</p> Find Code:
<p><b>(\d+)</b>\s … <br/><b>\d+</b>\s … </p> Code:
<h4>\1</h4></br><p> … </p><p> … </p> Find Code:
<p><b>(\d+)</b>\s(.*?)<br/><b>\d+</b>\s(.*?)</p> Code:
<h4>50:\1</h4><p>\2</p><p>\3</p> |
![]() |
![]() |
![]() |
#645 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 179
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
|
Is it possible to make a regex to turn a phrase with "fake small caps" into a sentence-case phrase, whilst also handling the occasional capitalised proper name in the middle? It must:
1. remove the spans; 2. put all the text between the spans into lower case, leaving the letters outside the spans in upper case; 3. (this is the tricky part) there may be one span on the whole phrase OR there may be several on different parts of the phrase, so it may be necessary to do a multi-part regex. Example: Find this: Code:
<span class="Cap">F</span><span class="SmallCap">IRST WORD OF THE SENTENCE IS ALWAYS CAPITALISED,</span> <span class="Cap">O</span><span class="SmallCap">OTHER</span> <span class="Cap">W</span><span class="SmallCap">WORDS IN THE SENTENCE MAY OR MAY NOT BE CAPITALISED</span> First word of the sentence is always capitalised, Other Words in the sentence may or may not be capitalised If there is just one span I can manage it but since there can be two or three (or potentially more) spans I am not sure how to manage those possibilities. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Examples of Subgroups | emonti8384 | Lounge | 32 | 02-26-2011 06:00 PM |
Accessories Pen examples | Gunnerp245 | enTourage Archive | 15 | 02-21-2011 03:23 PM |
Stylesheet examples? | Skitzman69 | Sigil | 15 | 09-24-2010 08:24 PM |
Examples | kafkaesque1978 | iRiver Story | 1 | 07-26-2010 03:49 PM |
Looking for examples of typos in eBooks | Tonycole | General Discussions | 1 | 05-05-2010 04:23 AM |