title: Regex reverse lookup in xsl matches function
body: <p>I am trying to identify phone numbers that do not match certain criteria. Among oher things, I want to match international numbers that are not French (ie not +33 nor 0033). I have a regex that uses a reverse lookup (ie &quot;?!&quot;) to say &quot;not 33&quot; which works when I test it alone. However when I try to use it in an xsl stylesheet I get an error &quot;Invalid regular expression FORX0002&quot;.</p>
  <p>Here is the part of my Regex that is causing me problems</p>
  <p><code>^((\+|00)(?!33)[1-9]\d{0,2})\D?(\d\D?){9,14}$</code></p>
  <p>Simplified stylesheet:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;xsl:stylesheet version=&quot;2.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:fo=&quot;http://www.w3.org/1999/XSL/Format&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:fn=&quot;http://www.w3.org/2005/xpath-functions&quot; exclude-result-prefixes=&quot;fo fn xs&quot;&gt;
      &lt;xsl:output method=&quot;xml&quot; version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; indent=&quot;yes&quot;/&gt;
      &lt;xsl:template match=&quot;/&quot;&gt;
          &lt;root class=&quot;object&quot;&gt;
              &lt;contacts class=&quot;array&quot;&gt;
                  &lt;xsl:for-each select=&quot;//row&quot;&gt;
                      &lt;row&gt;
                          &lt;xsl:if test=&quot;not(matches(., '^((\+|00)(?!33)[1-9]\d{0,2})\D?(\d\D?){9,14}$'))&quot;&gt;
                              &lt;Business_Phone&gt;
                                  &lt;xsl:value-of select=&quot;.&quot;/&gt;
                              &lt;/Business_Phone&gt;
                          &lt;/xsl:if&gt;
                      &lt;/row&gt;
                  &lt;/xsl:for-each&gt;
              &lt;/contacts&gt;
          &lt;/root&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt; 
  </code></pre>
  <p>Sample data:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;root&gt;
      &lt;row&gt;
          &lt;Identifier&gt;02&lt;/Identifier&gt;
          &lt;Name&gt;John Doe&lt;/Name&gt;
          &lt;Business_Phone&gt;+34 67.89&lt;/Business_Phone&gt;
      &lt;/row&gt;
      &lt;row&gt;
          &lt;Identifier&gt;03&lt;/Identifier&gt;
          &lt;Name&gt;Jim Doe&lt;/Name&gt;
          &lt;Business_Phone&gt;+33 123 456 789&lt;/Business_Phone&gt;
      &lt;/row&gt;
  &lt;/root&gt; 
  </code></pre>
  <p>With this sample I am expecting to get:</p>
  <pre><code>&lt;root class=&quot;object&quot;&gt;
      &lt;contacts class=&quot;array&quot;&gt;
          &lt;row&gt;
              &lt;Identifier class=&quot;string&quot;&gt;02&lt;/Identifier&gt;
              &lt;Business_Phone&gt;+34 67.89&lt;/Business_Phone&gt;
          &lt;/row&gt;
      &lt;/contacts&gt;
  &lt;/root&gt;
  </code></pre>
  <p>Is there a syntax I can use to make this work?
  Many thanks</p>