Why?
What is its inconsistency?
Code:
<p><a(?: class="backlink")? href="(.+?)" id="(.+?)">([0-9]{1,4})</a>(?:\s)*(.+?)</p>
Note: This group that starts with
?: is not included in the group count, so whether the class will be or not - it should be OK.
Replace:
Code:
<p><a href="\1" id="\2">\3</a>\4</p>
Since in pure Sigil replacing finding
(\s)*(.+?) does not remove spaces, use the "Pavulon" function (works in beta version):
Code:
def replace(match, number, file_name, metadata, data):
if match:
return "<p><a href=\"" + match.group(1) + "\" id=\"" + match.group(2) + "\">" + match.group(3) + "</a>" + match.group(4) + "</p>"
I don't quite understand what you're trying to achieve, but I hope this helps.