Re: [xsl] Implementation Advice: Grouping Strings by Character Range in XSLT 2

Subject: Re: [xsl] Implementation Advice: Grouping Strings by Character Range in XSLT 2
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Apr 2016 19:29:56 -0000
On 29.04.2016 20:38, Eliot Kimber ekimber@xxxxxxxxxxxx wrote:
I have my generated analyze-text approach working generally. However, some
of my regular expressions are not matching when I would expect them to.

For example, given this @regex value:


regex="'([&#xa9;&#xae;&#x2120;&#x2122;]+)|([&#xa6;&#xb2;&#xb3;&#xb9;&#xbc;& #xbd;&#xbe;&#xd0;&#xd7;&#xdd;&#xde;&#xf0;&#xfd;&#xfe;&#x160;&#x161;&#x2202; &#x220f;&#x2211;&#x2212;&#x222b;&#x2260;&#x2264;&#x2265;]+)|([&#x27a4;]+)'"


And this text:


"&#x00A9;&#x00AE;"

The regular expression does not match, even though the first group clearly
matches on \uA9 and \uAE.

Have I made a stupid syntax mistake in my regular expression? Is there
some subtlety to matching groups that makes XSLT different from what
Oxygen is doing? I can't see any obvious syntax error in the regular
expression.

The problem is the single quote you have wrapped the regular expression into, the regex attribute is not an XPath expression, if you wanted that you would need to use an attribute value template. So I suppose you simply want

regex="([&#xa9;&#xae;&#x2120;&#x2122;]+)|([&#xa6;&#xb2;&#xb3;&#xb9;&#xbc;&
#xbd;&#xbe;&#xd0;&#xd7;&#xdd;&#xde;&#xf0;&#xfd;&#xfe;&#x160;&#x161;&#x2202;
&#x220f;&#x2211;&#x2212;&#x222b;&#x2260;&#x2264;&#x2265;]+)|([&#x27a4;]+)"


--- Diese E-Mail wurde von Avast Antivirus-Software auf Viren gepr|ft. https://www.avast.com/antivirus

Current Thread