View Single Post
Old 02-17-2014, 11:02 AM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,438
Karma: 27757438
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, you need to change the function to replace both the comment and the following number (if any), like this:

search expression

<!-- comment# -->(\d*)

function

Code:
def __call__(self, match):
   self.number += 1
   return '<!-- comment# -->' + str(self.number)
Then you can run it as many times as you like, each time the number will ge generated fresh.
kovidgoyal is offline   Reply With Quote