Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 02-17-2010, 07:48 AM   #1
superanima
W2E & ePub freak
superanima began at the beginning.
 
Posts: 38
Karma: 10
Join Date: May 2009
Device: cybook gen3 + boox60
I don't know how to use wilcards and regular expression....

how can I search this
Code:
<h2 id="calibre_toc_24">10 METZ</h2>
and replace it with this
Code:
<h2 id="calibre_toc_24">10<br>METZ</h2>
???

also, where can I find something to learn about this wildcard search?

thanks

Last edited by superanima; 02-17-2010 at 07:51 AM.
superanima is offline   Reply With Quote
Old 02-17-2010, 11:47 AM   #2
superanima
W2E & ePub freak
superanima began at the beginning.
 
Posts: 38
Karma: 10
Join Date: May 2009
Device: cybook gen3 + boox60
ok, this expression
Code:
(<h2 id="calibre_toc_\d*">\d*)(\s)
in the find field and this expression
Code:
 \1<br>
in the replace field worked for me
superanima is offline   Reply With Quote
Advert
Old 02-18-2010, 08:28 PM   #3
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
Superanima,

Your formula is probably fine, but just be careful when using RegEx. Because of it's power and versatility, it is very easy to create a formula that seems to do what you want.

The formula could also find some close, but not exact, matches. Unfortunately you only find out about these errors after the fact. Always try to match a unique combination of characters. If your program allows it also use manual search & replace, not automatic. This makes sure you do not accidentally make things harder for yourself. At least until you get a better understanding of RegEx.

Edit: I should mention that I've discovered this the hard way!

Last edited by Sabardeyn; 02-18-2010 at 08:34 PM.
Sabardeyn is offline   Reply With Quote
Old 02-20-2010, 06:47 AM   #4
LARdT
The LARdT of E-Books
LARdT began at the beginning.
 
LARdT's Avatar
 
Posts: 106
Karma: 46
Join Date: Dec 2009
Device: HANLIN V3ext (Papyre 6.1)
You can find several examples in my blog: http://mipapyreebookreader.blogspot.com/search/label/RegEx
LARdT is offline   Reply With Quote
Old 02-21-2010, 09:42 AM   #5
superanima
W2E & ePub freak
superanima began at the beginning.
 
Posts: 38
Karma: 10
Join Date: May 2009
Device: cybook gen3 + boox60
thanks both of you :-)
superanima is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression Help Azhad Calibre 86 09-27-2011 02:37 PM
Regular Expression Help smartmart Calibre 5 10-17-2010 05:19 AM
Need Help Creating a Regular Expression Worm Calibre 9 08-18-2010 01:20 PM
Regular Expression Help Needed dloyer4 Calibre 1 07-25-2010 10:37 PM
Help with the regular expression Dysonco Calibre 9 03-22-2010 10:45 PM


All times are GMT -4. The time now is 07:45 PM.


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