Don't know any python so a small request
Cook booking the example for auto numbering (changed to H1's) and if I re-run it then it adds another number (I was even able to figure out how to add the word 'Chapter' all by myself


)
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
section_number = '%d. ' % number
return match.group(1) + 'Chapter ' + section_number + match.group(2)
Q - Can someone tell me the tweak to have the function to delete any leading text up to and including the space after the '.' first? If files are rearranged or added or deleted then numbers will be off and re-running the RegEx-Function just adds more. I could do a 'regular' regular expression, but adding the logic to the function would be much handier
Code:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>blah</title>
</head>
<body>
<h1>Chapter 4. Chapter 4. Chapter 4. blah</h1>
</body>
</html>