Quote:
Originally Posted by Pavulon
<a (class="backlink")? href="(.*?)" id="(.*?)">([0-9] {1,4})</a>
In Sigil, it does not work, I only recover the link with the class. I also tried with the quantifier "*", without better result.
Does anyone know how to tell me?
Thanks.
|
Would your regex not make two spaces mandatory between <a and href?
I would think you'd need to make that first space optional as well.
<a( class="backlink")? href="(.*?)" id="(.*?)">([0-9] {1,4})</a>
I can't explain why your original would work on Regex 101 though.
There also appears to be space between your [0-9] character class and the {1,4}, but that could be an artifact of not pasting your regex between between code tags.
I can confirm that your regex works in Sigil if the first space in made optional (or the second space really--it doesn't matter):
Code:
<a( class="backlink")? href="(.*?)" id="(.*?)">([0-9]{1,4})</a
I wouldn't have expected the original to do what you wanted anywhere, to be honest.