Ok, I figured it out. My Search Regex was wrong.
I changed it to this...
PHP Code:
(<h2><span class="hide">)(\s–\s)(</span></h2>)
And adjusted "incr_chapter_number" to...
PHP Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
data.setdefault('chapnum', 19)
if match.group(2):
data['chapnum'] += 1
return match.group(1) + str(data['chapnum']) + match.group(2) + match.group(3)
return match.group(0)
And now it works correctly.
Do you know of any way to convert Number to Word eg 17 to Seventeen?