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 03-12-2012, 05:52 PM   #1
Adman35
Kindle enthusiast
Adman35 began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Mar 2012
Location: Reston, Virginia
Device: Kindle
Sigil Wildcards/Regex Find/Replace

Greetings All --

I've browsed through the Sigil manual and a bunch of posts here. Am I correct that the wildcard option in Find/Replace has been removed from Sigil 0.5.3, leaving Regex as the favored alternative? If my deduction isn't right, I'd appreciate someone telling me how to activate the wildcard option.

Regards,

-- Adman35
Adman35 is offline   Reply With Quote
Old 03-12-2012, 07:33 PM   #2
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: 15,086
Karma: 5939999
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Adman35 View Post
Greetings All --

I've browsed through the Sigil manual and a bunch of posts here. Am I correct that the wildcard option in Find/Replace has been removed from Sigil 0.5.3, leaving Regex as the favored alternative? If my deduction isn't right, I'd appreciate someone telling me how to activate the wildcard option.

Regards,

-- Adman35
to MR

Yes, (PCRE) REGEX is the preferred method no more old style wild card

as * and ? have special meanings in regex, remember to escape these if that is in your find term. \* \?
theducks is offline   Reply With Quote
 
Advertisement
Old 05-10-2012, 05:07 AM   #3
gfmoore
Junior Member
gfmoore began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jun 2011
Device: Kindle
This is very annoying! Why has it been removed? Why do I now have to spend hours of my life learning how to use regex?

If it aint broke don't fix it!
gfmoore is offline   Reply With Quote
Old 05-10-2012, 05:45 AM   #4
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 646
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
Because the old way was only any good in BookView or VERY basic searches, wasn't anywhere near powerful enough for use in CodeView, especially for anything more complex than replacing a straight search term.
Perkin is offline   Reply With Quote
Old 05-10-2012, 06:03 AM   #5
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,591
Karma: 14407087
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
Quote:
Originally Posted by gfmoore View Post
This is very annoying! Why has it been removed? Why do I now have to spend hours of my life learning how to use regex?

If it aint broke don't fix it!
I can highly recommend RegexBuddy, which is cheap and wondrous. ;-) For those of us who have weak regex-fu, it's brilliant. But truly, PCRE regex was badly, badly, badly needed in Sigil.

Hitch
Hitch is offline   Reply With Quote
Old 05-10-2012, 10:50 AM   #6
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: 15,086
Karma: 5939999
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by gfmoore View Post
This is very annoying! Why has it been removed? Why do I now have to spend hours of my life learning how to use regex?

If it aint broke don't fix it!
For a basic '*' or' ?' user, the REGEX is rather simple

Go read this tutorial, http://www.mobileread.com/forums/sho...d.php?t=118569

It took me from REGEX = to REGEX =


Also, grab yourself a (free) REGEX cheat sheet from http://www.addedbytes.com/cheat-sheets/

NB They also have HTML and CSS cheat sheets
theducks is offline   Reply With Quote
Old 05-10-2012, 12:04 PM   #7
huebi
Zealot
huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!huebi , Klaatu Barada Niktu!
 
Posts: 121
Karma: 5070
Join Date: Dec 2010
Device: none
Well, instead of using "*" use ".*" and instead of using "?" use ".". Here you are with wildcards. Its just that simple.
huebi is offline   Reply With Quote
Old 08-16-2014, 02:02 PM   #8
PHC
Junior Member
PHC can extract oil from cheesePHC can extract oil from cheesePHC can extract oil from cheesePHC can extract oil from cheesePHC can extract oil from cheesePHC can extract oil from cheesePHC can extract oil from cheesePHC can extract oil from cheese
 
Posts: 7
Karma: 1000
Join Date: Feb 2014
Device: iPhone, iPad
Though it is daunting at first, learning regex is the best thing you could do as it comes in handy in many situations. Sigil regex is less strict than 'official' regex and requires less strict regex code. An example that I am using right now:

I wanted to find code segments where a calibre-converted epub from a PDF was splitting sentences at every page break from the PDF, and replace it with nothing, i.e., remove the split. All I had to do was find the first example of this in the HTML file in Sigil, and highlight everything from the </p> tag at the end of the split line to the first character of the next word in the sentence, copy it, and paste it in the 'Find:' box:

Original:

Code:
opportunity to play with the girl, fleetingly and unbeknownst to Phyllis, before what Izzy called “nights out” each evening. Izzy was the only</p>

  <p class="whitespace">&nbsp;</p>

  <p class="calibre1">person who Petra could talk to about magic, although they had to keep it a sworn secret. Izzy loved Petra’s stories about
Highlighted:

Code:
</p>

  <p class="whitespace">&nbsp;</p>

  <p class="calibre1">
Then I added some regex code ([a-z0-9]) at the end to find the first character of the next word in the split line:

Code:
</p>

  <p class="whitespace">&nbsp;</p>

  <p class="calibre1">([a-z0-9])
This finds the split code plus the first character:

[Image violates guidelines for size - MODERATOR]


For 'Replace:', I just use ' \1' -- note the leading <space>. This replaces all the HTML code with a space and the found first character:

[Image violates guidelines for size - MODERATOR]


Whatever text is found within (…) is copied over by \1. So this basically 'unsplits' the line. The search/replace can be repeated with 'Find', 'Replace', 'Replace/Find', or if you're pretty sure this won't do something unexpected to code you'd rather keep, 'Replace All' -- be careful with this.

As far as tools to test your regex, first of all Sigil is the best tool you have because it highlights the results immediately. Or you can go to http://regex101.com/ and use their online tool. It is the very best one I found out of the dozens that I tried. It color codes your regex expressions and highlights your errors and tells you what you did wrong when you hover the mouse cursor over the highlighted error. Fantastic. It is my go-to regex tester. I have RegexBuddy and RegexMagic on Windows, and RegExRX and Reggy on OS X, and I never use them because this online tool is so much better.

[Image violates guidelines for size - MODERATOR]



[Image violates guidelines for size - MODERATOR]


Note that Sigil didn't require the '\' escape character for the '/'.

The best interactive regex tutorial I found is RegexOne - Learn regular expressions with interactive examples. It guides you through the basics and quizzes you at each step. The best complete tutorial and reference, from the makers of RegexBuddy, is Regular Expression Tutorial.

Last edited by Dr. Drib; 08-17-2014 at 07:40 AM.
PHC 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
More fun with regex / wildcards zelda_pinwheel Sigil 28 01-06-2013 10:57 AM
wildcards in search-replace sigil 0.4905? Capricorn Sigil 13 01-19-2012 09:22 PM
RegEx find and replace iblesq Sigil 1 01-10-2011 10:26 PM
REGEX find and replace help please potestus Sigil 13 09-18-2010 05:14 PM
wildcards in sigil bobcdy Sigil 2 12-18-2009 11:19 PM


All times are GMT -4. The time now is 02:49 AM.


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