Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 10-23-2014, 02:42 PM   #1
rosshalde
Zealot
rosshalde began at the beginning.
 
Posts: 142
Karma: 10
Join Date: Jun 2014
Device: nook
Regex questions (body of text only?)

I found that Sigil can use Regex in it find/replace function.
I am looking to find all examples of x.x (where x is any letter with a period in between)
Essentially, many words like book.case or back.pack that are compound words are displayed in my file as show above.
I see that I can find all examples of this by using the code
[a-z]\.[a-z]
which is great, but it is also finding all examples in the actual code, such as www.xxxx
Is there a way to tell Sigil to only look to find my search in the body of the text rather than in the code?
If so, that would be excellent and fix a big problem for me.
rosshalde is offline   Reply With Quote
Old 10-23-2014, 02:54 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
(no this doesn't work)

should find your search, but check for the preceding closing tag bracket (however far back that may be) and ensure that there is no opening tag bracket in between there and the matching text.

Uses the power of negative lookarounds, see here: http://www.regular-expressions.info/lookaround.html

(I checked for capital and lowercase, as you did not specify that you only wanted lowercase? Not sure if you forgot to check for uppercase or forgot to mention you were excluding them.)

Last edited by eschwartz; 10-23-2014 at 09:03 PM.
eschwartz is offline   Reply With Quote
Advert
Old 10-23-2014, 06:02 PM   #3
rosshalde
Zealot
rosshalde began at the beginning.
 
Posts: 142
Karma: 10
Join Date: Jun 2014
Device: nook
I tried to apply the code, but it didn't work.
I am a total novice, so I don't know what "opening tag bracket" to look for.
[a-zA-Z]\.[a-zA-Z] worked fine, but the preceding part made it find nothing.
Any more suggestions?
rosshalde is offline   Reply With Quote
Old 10-23-2014, 09:02 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
lookarounds do not advance the search very rudimentary mistake, sorry. (lookarounds are very fun to me but they also bend my head in knots.)

And this could be done a different way... if only lookbehind allowed variable-length strings. Fortunately, you can use the curly-bracket repeater for a finite variable-length string, but only in http://calibre-ebook.com's editor.

Code:
(?<=>[^<]{,99999})[a-zA-Z]\.[a-zA-Z]
Sigil doesn't use python's regex engine, so this doesn't work.

In Sigil, you can use:
Code:
(>[^<]*?)[a-zA-Z]\.[a-zA-Z]
And it will also capture the part from the preceding tag. However, it is captured and you can replace with "\1" followed by the replacement for the "x.y".
eschwartz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I change body text from bold to normal? Michaelus Calibre 13 07-28-2022 04:42 PM
Searching ebook body/text across library-Is it Possible? dnjmama Library Management 9 11-20-2014 10:41 AM
Fonts in body text in iBooks Oxford-eBooks ePub 1 11-15-2012 08:41 AM
Preferred Publisher Font for Body Text? DreamWriter Amazon Kindle 12 07-25-2012 04:15 AM
Fonts for body text - a small study (long) derangedhermit Workshop 9 08-25-2011 04:27 AM


All times are GMT -4. The time now is 08:47 PM.


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