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-03-2013, 03:25 PM   #16
theducks
Grand Sorcerer
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: 13,602
Karma: 5126946
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Hitch View Post
The part that cracks me up is that everyone here instantly assumed that the OP was seeking a regex solution. Somehow....something makes me think that wasn't actually the question. ;-)

Hitch
The OP did ask how to automatically do this.

Since this is a Sigil forum, we are not waaaay in left field, to assume a Sigil solution
theducks is offline   Reply With Quote
Old 07-03-2013, 03:47 PM   #17
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,004
Karma: 10381859
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
Quote:
Originally Posted by theducks View Post
The OP did ask how to automatically do this.

Since this is a Sigil forum, we are not waaaay in left field, to assume a Sigil solution
Ducky, heart of my heart:

Well...s/he said "automated." What we geeksters think of as automated mayn't be the same thing that s/he thought of as automated. Great regex, though! I may steal it!

Hitch
Hitch is online now   Reply With Quote
 
Enthusiast
Old 07-03-2013, 04:00 PM   #18
theducks
Grand Sorcerer
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: 13,602
Karma: 5126946
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Hitch View Post
Ducky, heart of my heart:

Well...s/he said "automated." What we geeksters think of as automated mayn't be the same thing that s/he thought of as automated. Great regex, though! I may steal it!

Hitch
any REGEX I post that is not attributed to others is very open source
theducks is offline   Reply With Quote
Old 09-28-2013, 12:48 AM   #19
automa
Connoisseur
automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.
 
automa's Avatar
 
Posts: 90
Karma: 972092
Join Date: Jan 2012
Device: iPhone
Quote:
Originally Posted by theducks View Post
I wonder if we should start a 'Saved Search thread' for frequently reused snips'

I define Frequent use as code that will see usage over many books rather than for a 1 time fix-n-patch job (which can be way more complicated in many cases)

Some of my saved Searches are really Models that need per case tuning before use

Code:
69\Name=Fixup/Promote Headings/Roman
69\Find="<p class=\"\\w\">([CLXVI]{1,7})</p>"
69\Replace="<hr class=\"sigil_split_marker\" /><h3 class=\"chapno\">\\1</h3>"
The green is a series (1 to 6) of possible roman characters in a separate paragraph tag. Everything surrounding the Green needs to be adjusted on a case-by-case use.

(I just copied the above direct from my saved search file)
Where do you put the code in at Sigil to affect the change?
Is there a Regex manual for Sigil? Is Regex a Sigil-dedicated programming language or used for other softwares too?
automa is offline   Reply With Quote
Old 09-28-2013, 03:36 AM   #20
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 2,740
Karma: 2117255
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
RegEx is short for Regular Expressions. It is a powerful way to do search and replaces. There are a number of dialects, but Sigil uses PCRE. That is quite a common dialect.

You can store your searches in the Search editor.
Toxaris is online now   Reply With Quote
Old 09-28-2013, 03:41 AM   #21
automa
Connoisseur
automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.
 
automa's Avatar
 
Posts: 90
Karma: 972092
Join Date: Jan 2012
Device: iPhone
Is there screenshot tutorial on how to use Regex on sigil?
automa is offline   Reply With Quote
Old 09-28-2013, 06:05 AM   #22
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,004
Karma: 10381859
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
Quote:
Originally Posted by automa View Post
Is there screenshot tutorial on how to use Regex on sigil?
Automa:

I think you may need to start with learning Regex first, but, if you wish to give it a go in Sigil, there's a pinned post at the top of the forum with some handy regex expressions. If you can afford it, I highly recommend Regex Buddy as a regex learning tool (It's about $40USD). If you have a good text/HTML editor, like NoteTab Pro, you can try some of the regex you see posted, above, therein, assuming it's PCRE-based (if it's NoteTab Pro, it is).

Once you have a handle on basic regex (and don't feel intimidated--it looks scary but is really just more advanced and fancy "search and replace" using logic), you can easily try it in the Sigil interface. Very simply, you would put your regex FIND expression in the Find box; you would put the "replace" regex in the "replace" box, make sure you've clicked "Regex" for Mode, and then make other selections as are needed (for example--Minimal Match, Dotall, Wrap, etc.).

You may wish to start out with a very simple expression, just for a Find, and do a count--see how that goes. Once you can find things using regex, you can go from one to the next, make sure you're getting the finds that you want. Then you can try a replace; again, do ONE only, and make sure that the result is what you want. When you first learn regex, as tedious as it is, you should not do "replace all" until you have it down.

This is the best "El Quickie" tutorial I can give you. I know that there are scads of regex websites out there, and I think (sorry, cannot remember who) one of the MR'ers has a lovely tutorial on the basics of regex, somewhere around here--Ducky will know and post it, if my memory is correct. Again, though, if you can afford it, you may wish to take Regex Buddy out for a spin. It's a complicated and confusing interface to look at and immediately master, but the learning curve is very fast, once you get past how "clunky" the teaching page looks. :-)

Hope that helps!

Hitch
Hitch is online now   Reply With Quote
Old 09-28-2013, 10:41 AM   #23
theducks
Grand Sorcerer
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: 13,602
Karma: 5126946
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Hitch
I think you are thinking of the one by Manichean
http://www.mobileread.com/forums/sho...d.php?t=118569

Automa
Others have said it
Sigil uses PCRE REGEX.
This is not some sort of special to Sigil REGEX


Since the tutorial was written, Sigil added saved searches and supplied a 'starter set'.
A Sigil saved search has 3 parts:
1) A title (so you can find it again )
2) The Search term
3) the Replace pattern
What they do NOT include is:
(document) Scope
Search mode. Saved searches do not have to be REGEX searches
direction and wrap status

Read the tutorial, Reverse engineer some of the starter saved searches to confirm your understanding.
Visit the Tyrannosaurus Regex thread here at MR for further enlightenment
theducks is offline   Reply With Quote
Reply

Tags
regex wiki

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table of contents in pdf files pvdas Onyx Boox 3 12-14-2012 05:45 AM
Most efficient way to process file contents of exploded ePub Agama Development 4 09-23-2012 07:49 AM
adding table of contents to html files jfs999 Conversion 2 09-30-2011 02:25 PM
Make Table of Contents? banjobama Calibre 18 06-25-2011 08:13 AM
How to make a PDF table of contents work in epub ajbrutico Calibre 3 09-26-2010 09:31 AM


All times are GMT -4. The time now is 05:38 PM.


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