Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 12-23-2014, 11:12 PM   #1
weberr
New old guy
weberr began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Feb 2012
Device: kindle fire
Regex: incrimenting/decrimenting

Is there a way to increment/decriment a value before replacing it?
I have a book structured with 90 chapters, each chapter a separate file; however, the chapter numbers are 38-90 (probably from using EpubSplit to break up a 'complete set'.
I would like to renumber the Chapters to be 1-90.
The chapter headings are easy to find: <h2 class="calibre1">Chapter ([0-9]+)</h2>
For replacement is there something akin to <h2 class="calibre1">Chapter \1-37</h2>
weberr is offline   Reply With Quote
Old 12-23-2014, 11:28 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)
The calibre editor can do this, with a regex function.

http://manual.calibre-ebook.com/function_mode.html
eschwartz is offline   Reply With Quote
Old 12-24-2014, 12:02 AM   #3
weberr
New old guy
weberr began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Feb 2012
Device: kindle fire
Regex: incrimenting/decrimenting

Quote:
Originally Posted by eschwartz View Post
The calibre editor can do this, with a regex function.

http://manual.calibre-ebook.com/function_mode.html


Didn't know that the calibre editor had a Regex-Function mode and didn't know there was such a detailed manual for using it. Should have known that calibre had it covered. It always does.
weberr is offline   Reply With Quote
Old 12-24-2014, 12:09 AM   #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)
It is a relatively new feature.

Although anyone keeping a close eye on certain discussions would have seen Kovid's post indicating that this was going to happen, going back quite some time.


Quote:
Originally Posted by calibre What's New

Release: 2.11 [21 Nov, 2014]
New Features
  • Edit Book: Add a new 'function mode' for the Search and Replace tool
    The function mode allows you to create python functions that run on the results of Search and Replace. This allows you to do arbitrarily powerful text processing. For example, you can automatically fix the case of text, automatically add section number to headings, and so on. For examples and documentation, see: http://manual.calibre-ebook.com/function_mode.html
eschwartz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex help please bremler Workshop 10 04-24-2014 09:46 PM
Help with some regex Chaos_Therum Library Management 1 12-28-2013 11:20 AM
Regex help paulfiera Sigil 4 06-14-2012 07:55 AM
Regex Gunnerp245 Conversion 5 03-05-2012 04:15 PM
Help me with regex please. eVrajka Library Management 5 08-15-2011 12:17 PM


All times are GMT -4. The time now is 01:35 AM.


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