Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old Today, 09:45 AM   #1
KarlG
Connoisseur
KarlG began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2024
Device: none
Possible RegEx error in Sigil (minimal match being ignored)

Hello,

I'm trying to delete all 'span' tags with no content (i.e. <span blah blah>(nothing here)</span> by using the following RegEx (with minimal match enabled)

<span .*></span>

Here is some example text which shouldn't match anything

<hgroup><h2 class="CHAPTER" id="ch1"><span class="CN"><samp class="SANS_Futura_Std_Bold_Condensed_B_11">1</samp></span> <span class="CT"><samp class="SANS_Dogma_OT_Bold_B_11">WINDOWS FOUNDATIONAL CONCEPTS</samp></span></h2></hgroup>

As we can see, there are no span tags without content. Running this RegEx however matches the following text (as can be seen in the attached screenshot)
<span class="CN"><samp class="SANS_Futura_Std_Bold_Condensed_B_11">1</samp></span>

Is there anything I have missed, or is this indeed an error?

Rgds

Karl
Attached Thumbnails
Click image for larger version

Name:	regex error.png
Views:	14
Size:	22.3 KB
ID:	210250  
KarlG is offline   Reply With Quote
Old Today, 11:29 AM   #2
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,629
Karma: 23190435
Join Date: Dec 2010
Device: Kindle PW2
The .* in your regular expression also matches other tags. The following expression should work:

Code:
<span[^>]*></span>
Doitsu is offline   Reply With Quote
Advert
Old Today, 11:34 AM   #3
KarlG
Connoisseur
KarlG began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Mar 2024
Device: none
Quote:
Originally Posted by Doitsu View Post
The .* in your regular expression also matches other tags. The following expression should work:

Code:
<span[^>]*></span>
But surely when 'minimal match' is selected, the search should also stop with the first '>'.?
KarlG is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
match an empty line with a regex? lumpynose Sigil 5 05-29-2019 03:03 AM
REGEX match everything before # JLius ePub 2 01-08-2017 04:25 PM
[Regex Search] Minimal match not possible? nqk Editor 7 12-24-2014 03:19 AM
how to have regex dot match any character including newline? gnychis Calibre 5 11-30-2010 06:35 PM
Need help with a conversion regex - can't match newline ereader123 Calibre 2 03-29-2010 10:58 AM


All times are GMT -4. The time now is 12:19 PM.


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