03-10-2014, 02:11 PM | #1 |
Member
Posts: 20
Karma: 10
Join Date: Dec 2013
Device: Pocketbook touch lux (623)
|
regex search/replace - how to?
Hi all,
I have a lot of weeklies which I want to edit and make them formatted equally. They all have chapters with a chapter-number and with 0 up to 3 sub-lines. Here is an example: Code:
<body> <p> </p> <p>1.</p> <p> </p> <p>Line One</p> <p> </p> <p>Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one. Chapter one.</p> <p>Chapter one para two.</p> <p> </p> <p>2.</p> <p> </p> <p>Line One</p> <p>Line two</p> <p> </p> <p>Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two. Chapter two.</p> <p>Chapter two para one.</p> <p> </p> <p>3.</p> <p> </p> <p>Line One</p> <p>Line two</p> <p>Line three</p> <p> </p> <p>Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three. Chapter three.</p> <p>Chapter three para two.</p> <p> </p> <p>4.</p> <p> </p> <p>Line One</p> <p>Line two</p> <p>Line three</p> <p>Line four</p> <p> </p> <p>Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four. Chapter four.</p> <p>Chapter four para two.</p> <p> </p> </body> Code:
<hr class="sigilChapterBreak" /> <h1 class="h11">\1</h1> <p class="p0"><span class="t4">\2<br/>\3</span></p> Is there a way to make a search finding the chapter-number plus the existing number of sub-lines and replace them according the above example? If not please help me in creating a search that finds not more than the FIRST . 1000 thanks in advance. Peter |
03-11-2014, 09:53 PM | #2 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
".*(?! ). " will match all characters up to and including the first match for " " using a negative lookahead.
"(?!string)" is not a capture group! |
Advert | |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
search/replace multiline regex | Alt68er | Sigil | 4 | 02-01-2014 10:40 AM |
Regex search and replace | dwlamb | Sigil | 6 | 04-12-2013 03:34 PM |
regex search/replace | Sharlene | Sigil | 10 | 01-28-2012 05:14 AM |
Search & Replace/Regex help!! | millertime13 | Conversion | 4 | 07-22-2011 03:40 AM |
need regex help search and replace | schuster | Calibre | 4 | 01-10-2011 10:00 AM |