Thread: Regex examples
View Single Post
Old 10-11-2019, 01:37 PM   #618
BillPearl
Junior Member
BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.BillPearl ought to be getting tired of karma fortunes by now.
 
Posts: 7
Karma: 591908
Join Date: Jun 2011
Device: Kindle
Here are a pile of 'code error' corrections I have accumulated over time. Few are mine, most are from generous people who have shared their efforts. Thanks to all of you.
Suggest you copy and paste into a new text file.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
FIND / REPLACE text (use with tags)
For a string of letters and numbers
([^>]+)(.*?)
eg.
<a name="Chapter_LIII" id="Chapter_LIII"></a>
<a([^>]+)(.*?)></a>
or
<body id="0-a5e9337bbdff40f4b38c8f20e5723a9a" class="calibre">
Find id="0-a5e9337bbdff40f4b38c8f20e5723a9a"
With id=([^>]+)(.*?) class

some text like, id=, then ([^>]+)(.*?) and then something to end string of letters & numbers

Find number in <b> in Regex mode
<b>[0-9]+</b>

Find Roman Numerals
lower or UPPER CASE
[xvi]+
[XVI]+ \>I[XVI]+

[1 space]
\[\s]

Find I, II, III
<p>[I]+</p>

Find Pg ### in Regex mode (?DotAll)
[P][g] (\d+)
[P][g] [xvi]+

Find Page_394 in Regex mode (?DotAll)
\Q"Page_\E(\d+)"

Find id="sigil_toc_id_3"
\Qid="sigil_toc_id_\E(\d+)"


[^\.] will match anything but . eg [^\.>]</

[,;:] will match any punctuation except period
[^,;:], where ^ stands for NOT in the character set.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

Last edited by DiapDealer; 10-12-2019 at 10:44 AM.
BillPearl is offline   Reply With Quote