View Single Post
Old 03-08-2019, 09:17 AM   #1
hantsaniala
Member
hantsaniala began at the beginning.
 
hantsaniala's Avatar
 
Posts: 16
Karma: 10
Join Date: Dec 2015
Device: sigil
A bug with the regex ?

Hello everyone,

I'm trying to use regex for dynamic id remplacement but I got some error that I don't know how to fix, that's why I'm asking for help.

I've seen somewhere in this website that Sigil use PCRE.

Regex pattern :
Code:
<a id=\"(.*)?\">([\W\s]*)?([\w]+)( ([ \?*])+)?((, )?(.*)?([A-Z])(.*))?<\/a>
Replace pattern :
Code:
<a id="\3\9">\2\3\4\6</a>
Test string :
Code:
<a id="">Anzil ou Auzil, Jacques d’</a>
The result I want :
Code:
<a id="AnzilJ">Anzil ou Auzil, Jacques d’</a>
But the result I got :
Code:
<a id="AJ">Anzil ou Auzil, Jacques d’</a>
Note that this regex work with https://regex101.com and https://regexr.com.
Sigil version : 0.9.10.

hantsaniala is offline   Reply With Quote