Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 07-26-2025, 10:01 PM   #796
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,073
Karma: 6361556
Join Date: Nov 2009
Device: many
You can change the amount of context provided, but if you walk through things one by one anyway, you can easily pick out which instances to skip, and even edit the text directly to handle all cases you want. So I guess I do not understand the problem you are trying to solve if you already plan to walk things manually.
KevinH is online now   Reply With Quote
Old 07-26-2025, 10:13 PM   #797
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 507
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by KevinH View Post
You can change the amount of context provided, but if you walk through things one by one anyway, you can easily pick out which instances to skip, and even edit the text directly to handle all cases you want. So I guess I do not understand the problem you are trying to solve if you already plan to walk things manually.
The issue is the replacement value. I'm not trying to manually type in a different replacement value for each match. I just want to insert an apostrophe, be it in a blank space, or before an "s", or a "t", or an "ll", or am "re".

Last edited by ElMiko; 07-26-2025 at 10:22 PM.
ElMiko is offline   Reply With Quote
Old 10-25-2025, 10:20 PM   #798
Torgo
Junior Member
Torgo began at the beginning.
 
Torgo's Avatar
 
Posts: 2
Karma: 10
Join Date: Sep 2025
Device: iPad
I'm using Sigil 2.6.0 and trying to match attributes like: epub:type="frontmatter titlepage" (where the value is variable.)

I expected
Code:
epub:type="[^"]*"
to match it, but it does not.

From what I can tell from the user guide, skimming this thread, and trying an online expression tester, it should work. What am I missing?
Torgo is offline   Reply With Quote
Old 10-25-2025, 10:53 PM   #799
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,688
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Try... epub:type=".*?"

Do you need to capture and reuse the value? If yes, surround with brackets (.*?)
Karellen is offline   Reply With Quote
Old 10-26-2025, 01:16 AM   #800
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,763
Karma: 24088559
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Torgo View Post
I expected
Code:
epub:type="[^"]*"
to match it, but it does not.
Since the regex definitely works, you might have forgotten to select Regex mode in Sigil or there are one or more spaces before and after the equal sign.
Try
Code:
epub:type\s*=\s*"[^"]*"
Doitsu is offline   Reply With Quote
Old 10-26-2025, 01:25 AM   #801
Torgo
Junior Member
Torgo began at the beginning.
 
Torgo's Avatar
 
Posts: 2
Karma: 10
Join Date: Sep 2025
Device: iPad
Quote:
Originally Posted by Doitsu View Post
Since the regex definitely works, you might have forgotten to select Regex mode in Sigil
That was it. Thanks!

I was using regex earlier, and I'm not sure how I switched that off.
Torgo is offline   Reply With Quote
Old 10-31-2025, 03:13 PM   #802
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: 8
Karma: 591908
Join Date: Jun 2011
Device: Kindle
For a string of letters and numbers
([^>]+)(.*?)
\w to match any single alphanumeric character: 0-9, a-z, A-Z, and _ (underscore)
\s to match any single whitespace character.
\d any single digit
eg.
use some text ([^>]+)(.*?) & something to end string of letters & numbers

<a name="Chapter_LIII" id="Chapter_LIII"></a>
<a([^>]+)(.*?)></a>
BillPearl is offline   Reply With Quote
Old 10-31-2025, 09:57 PM   #803
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 507
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by BillPearl View Post
For a string of letters and numbers
([^>]+)(.*?)
\w to match any single alphanumeric character: 0-9, a-z, A-Z, and _ (underscore)
\s to match any single whitespace character.
\d any single digit
eg.
use some text ([^>]+)(.*?) & something to end string of letters & numbers

<a name="Chapter_LIII" id="Chapter_LIII"></a>
<a([^>]+)(.*?)></a>
The "(.*?)" isn't actually doing anything that the first captured string "([^>]+) isn't doing already.

If you try you set your replacement value to \2 (i.e. so that it references your (.*?) expression), you'll see that there's functionally a null replacement value. In otherwords, it's not actually matching anything.

I would generally render your search as:

Code:
<a[^>]*?></a>
Which will match <a name="Chapter_LIII" id="Chapter_LIII"></a>

Or, in the event that there might be text in the hyperlink code such as <a name="Chapter_LIII" id="Chapter_LIII">SOME TEXT HERE</a>:

Code:
<a[^>]*?>.*?</a>
... deploying parentheses as needed if the replacement value needs to reference particular elements of the matched string.


EDIT: I use * instead of +, but I'm fairly certain that in conjunction with the ? greedy quantifier, you could just as easily swap the * out for a + without affecting the search behavior.

EDIT2: Sorry, just a point of clarification, the second regex example I used above will also match <a name="Chapter_LIII" id="Chapter_LIII"></a>. But if you ONLY wanted to match hyperlinks that have no display text, the first regex is the one you want.

Last edited by ElMiko; 10-31-2025 at 10:22 PM.
ElMiko is offline   Reply With Quote
Old 10-31-2025, 11:53 PM   #804
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,271
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Here is My find (just) Roman
Code:
<p class="\w">([CLXVI]{1,7})</p>
I do a minor adjust if additional word like Chapter are needed.
theducks is offline   Reply With Quote
Old 11-01-2025, 03:37 AM   #805
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 507
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by theducks View Post
Here is My find (just) Roman
Code:
<p class="\w">([CLXVI]{1,7})</p>
I do a minor adjust if additional word like Chapter are needed.
That's a lot cleaner than what I've used for that historically. Only thing I'd add is that the character negation @BillPearl used above might come in handy here, too. So, to isolate the Roman headings within any <p> element, you could search for:

Code:
<p[^>]*?>([CLXVI]{1,7})</p>
The only other note I'd make is that if you are trying to capture all chapter headings with up to 100 chapters (which the inclusion of "C" would suggest), you probably need to change your quantifier range to {1,8} since technically there's one number between 1 and 100 that's 8 characters long (88 or LXXXVIII).

Last edited by ElMiko; 11-01-2025 at 03:44 AM.
ElMiko is offline   Reply With Quote
Old 11-01-2025, 01:37 PM   #806
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,271
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by ElMiko View Post
That's a lot cleaner than what I've used for that historically. Only thing I'd add is that the character negation @BillPearl used above might come in handy here, too. So, to isolate the Roman headings within any <p> element, you could search for:

Code:
<p[^>]*?>([CLXVI]{1,7})</p>
The only other note I'd make is that if you are trying to capture all chapter headings with up to 100 chapters (which the inclusion of "C" would suggest), you probably need to change your quantifier range to {1,8} since technically there's one number between 1 and 100 that's 8 characters long (88 or LXXXVIII).
Good Catch (8)
L.E, Modesitt pushes the count frequently
theducks is offline   Reply With Quote
Old 11-02-2025, 10:13 AM   #807
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 507
Karma: 65460
Join Date: Jun 2011
Device: Kindle
@theducks, you know, now that I think about it some more, I'm wondering if the upper range on the quantifier is necessary at all. Since there are no other permitted characters (including spaces)—except potentially "Chapter"—and I don't think there are any words that are composed exclusively of any combination of those 5 letters and that wouldn't already be capture by the existing {1,8} range (e.g. "ILL" or "CIVIL"), it seems the quantifier isn't actually limiting any false positives that {1,} would erroneously include.

What do you think?
ElMiko is offline   Reply With Quote
Old 11-02-2025, 11:15 AM   #808
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,271
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by ElMiko View Post
@theducks, you know, now that I think about it some more, I'm wondering if the upper range on the quantifier is necessary at all. Since there are no other permitted characters (including spaces)—except potentially "Chapter"—and I don't think there are any words that are composed exclusively of any combination of those 5 letters and that wouldn't already be capture by the existing {1,8} range (e.g. "ILL" or "CIVIL"), it seems the quantifier isn't actually limiting any false positives that {1,} would erroneously include.

What do you think?
You might be right... But... Why not? Belt and suspenders
theducks is offline   Reply With Quote
Old 11-02-2025, 02:12 PM   #809
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 507
Karma: 65460
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by theducks View Post
You might be right... But... Why not? Belt and suspenders
Fair enough...

But just think, if you take out the upper limit on the quantifier, you could capture Roman numeral headings all the way up to 899!

L.E. Modesitt, eat your heart out!
ElMiko is offline   Reply With Quote
Old 11-02-2025, 02:23 PM   #810
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,397
Karma: 20212733
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by ElMiko View Post
Fair enough...

But just think, if you take out the upper limit on the quantifier, you could capture Roman numeral headings all the way up to 899!

L.E. Modesitt, eat your heart out!
Not quite...399 is it, because when you get to 400 you would incorporate the "D" for 500.

388 = CCCLXXXVIII
389 = CCCLXXXIX
390 = CCCXC
399 = CCCXCIX
400 = CD

In the case of 388 you would need 11 characters.

The only books I know of with chapters that get that high are the web serials that get broken down into individual books when published to Amazon....

Last edited by Turtle91; 11-02-2025 at 02:27 PM.
Turtle91 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Examples of Subgroups emonti8384 Lounge 32 02-26-2011 07:00 PM
Accessories Pen examples Gunnerp245 enTourage Archive 15 02-21-2011 04:23 PM
Stylesheet examples? Skitzman69 Sigil 15 09-24-2010 09:24 PM
Examples kafkaesque1978 iRiver Story 1 07-26-2010 04:49 PM
Looking for examples of typos in eBooks Tonycole General Discussions 1 05-05-2010 05:23 AM


All times are GMT -4. The time now is 03:34 PM.


MobileRead.com is a privately owned, operated and funded community.