I have a RegEx that does not match using PHP (nor regex101.com) but does with MariaDB. Its purpose is to search for HTML classes in XML values (the HTML is encoded).
Here is an example XML value where you can see a <ul> element with a liste--non-ordonnee--gros--exergue CSS class:
<ul class="liste--non-ordonnee--gros--exergue">
I want the RegEx to match only full classes. Therefore if I search --exergue I don't want it to match.
Using PHP or other PCRE/PCRE2 online tester it does not match:
~(class="(?:[^&]*\s)?)--exergue~sU
But using MariaDB (v10.2.40 - PCRE 8.42), it matches:
(?sU)(class="(?:[^&]*\s)?)--exergue
It looks for a class attribute containing the class to replace. I tried to change the class name to something else for demonstration purposes (searching --suffix in class-with--suffix) but then it would not match anymore on the MariaDB version.
What is wrong with my RegEx or its MariaDB version ?
I am aware that regular expressions should not be used with HTML and am open to alternatives but this is TYPO3: storing encoded HTML into XML values in a db column. Design changes require massive class renaming.