<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>UPDATE: msautotest now pass against PCRE2 with a few extra fixes.<br>
    </p>
    <p>This was actually quite helpful to uncover 2 underlying issues,
      not related to PCRE2 itself:<br>
    </p>
    <p>- one (likely) wrong default regex with
      ms_map_bad_pattern_default in msCGILoadMap() where escaping
      antislash was missing (probably tolerated by GNU regex , but PCRE2
      is more picky about that). Easy to fix<br>
    </p>
    <p>- and more embarrassing, our redefined MS_REG_xxxx constants in
      mapregex.h happen to not match the values of GNU regex (they might
      perhaps have matched in earlier times, but things have drifted
      apart since then)... In particular, MS_REG_NOSUB = 4 was thus
      wrongly interpreted as REG_NEWLINE = (1 << 2). I loose some
      extra hair on figuring that out. The symptom was in rfc62.map
      where a query string parameter whose value is "foo%0Abar" (foo
      newline bar) happened to validate (with GNU regex) the following
      expression '^[a-z]{1,16}$' whereas it shouldn't have (our expected
      result was incorrect). The value matched because msEvalRegex()
      sets MS_REG_NOSUB which was wrongly interpreted as REG_NEWLINE,
      thus making the caret / dollar to apparently match any line
      instead of the whole string. When using PCRE2, the match didn't
      occur because PCRE2 and GNU regex have exactly subtle different
      semantics regarding newline matching (I tried to understand
      <a class="moz-txt-link-freetext" href="https://www.pcre.org/current/doc/html/pcre2posix.html#SEC5">https://www.pcre.org/current/doc/html/pcre2posix.html#SEC5</a>, but
      beyond my mastering)</p>
    <p>So all in all, it seems PCRE2 could be a viable alternative. I
      would expect "subtle" differences, so any mapfile having regular
      expressions in it that was tested with GNU/BSD/POSIX/whatever
      regex should be carefully checked for correct execution if
      switching to PCRE2</p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 08/06/2024 à 15:35, Even Rouault via
      MapServer-dev a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:ac40b04e-7124-4b90-b684-4767e50cbcc3@spatialys.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Hi,</p>
      <p>my attempt at <a class="moz-txt-link-freetext"
          href="https://github.com/MapServer/MapServer/pull/7073"
          moz-do-not-send="true">https://github.com/MapServer/MapServer/pull/7073</a>
        . It links, but PCRE2 doesn't seem to speak the same regex
        dialect as GNU regex...<br>
      </p>
      <p>Even<br>
      </p>
      <div class="moz-cite-prefix">Le 08/06/2024 à 05:31, Paul Ramsey
        via MapServer-dev a écrit :<br>
      </div>
      <blockquote type="cite"
cite="mid:69B64856-4C8D-4688-91ED-EE4D1937F9C4@cleverelephant.ca">
        <meta http-equiv="content-type"
          content="text/html; charset=UTF-8">
        Looks like it was in Centos as far back as 7, and is in base
        Ubuntu. It’s in MacPorts and Homebrew. So, fairly common?
        <div>P.<br id="lineBreakAtBeginningOfMessage">
          <div><br>
            <blockquote type="cite">
              <div>On Jun 7, 2024, at 8:06 PM, Steve Lime <a
                  class="moz-txt-link-rfc2396E"
                  href="mailto:sdlime@gmail.com" moz-do-not-send="true"><sdlime@gmail.com></a>
                wrote:</div>
              <br class="Apple-interchange-newline">
              <div>
                <div dir="auto">One would think replacement wouldn’t be
                  that hard. It’s pretty localized in MapServer. Is
                  pcre2 widely available?</div>
                <div><br>
                  <div class="gmail_quote">
                    <div dir="ltr" class="gmail_attr">On Fri, Jun 7,
                      2024 at 2:40 PM Paul Ramsey via MapServer-dev <<a
                        href="mailto:mapserver-dev@lists.osgeo.org"
                        moz-do-not-send="true"
                        class="moz-txt-link-freetext">mapserver-dev@lists.osgeo.org</a>>
                      wrote:<br>
                    </div>
                    <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">We
                      dragged around a dependency on pcre which got
                      updated to pcre2 lately. <br>
                      <br>
                      > On Jun 7, 2024, at 12:38 PM, Howard Butler
                      via MapServer-dev <<a
                        href="mailto:mapserver-dev@lists.osgeo.org"
                        target="_blank" moz-do-not-send="true"
                        class="moz-txt-link-freetext">mapserver-dev@lists.osgeo.org</a>>
                      wrote:<br>
                      > <br>
                      > I was playing around with getting Conda Forge
                      builds of MapServer working, and when I got to
                      Windows, I realized we need the GNU Regex library<br>
                      > <br>
                      > <a
href="https://github.com/conda-forge/mapserver-feedstock/issues/47#issue-2341018003"
                        rel="noreferrer" target="_blank"
                        moz-do-not-send="true"
                        class="moz-txt-link-freetext">https://github.com/conda-forge/mapserver-feedstock/issues/47#issue-2341018003</a><br>
                      > <br>
                      > It is ancient, not released as a standalone
                      library anymore, and causes anything linking
                      against it to also be GPL (which we're doing in
                      the Windows build situation). Maybe it is not
                      worth the trouble to change anything, but if one
                      were to do so, what should be used in its place?<br>
                      > <br>
                      > Howard<br>
                      >
                      _______________________________________________<br>
                      > MapServer-dev mailing list<br>
                      > <a
                        href="mailto:MapServer-dev@lists.osgeo.org"
                        target="_blank" moz-do-not-send="true"
                        class="moz-txt-link-freetext">MapServer-dev@lists.osgeo.org</a><br>
                      > <a
href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev"
                        rel="noreferrer" target="_blank"
                        moz-do-not-send="true"
                        class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a><br>
                      <br>
                      _______________________________________________<br>
                      MapServer-dev mailing list<br>
                      <a href="mailto:MapServer-dev@lists.osgeo.org"
                        target="_blank" moz-do-not-send="true"
                        class="moz-txt-link-freetext">MapServer-dev@lists.osgeo.org</a><br>
                      <a
href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev"
                        rel="noreferrer" target="_blank"
                        moz-do-not-send="true"
                        class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a><br>
                    </blockquote>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
        <br>
        <fieldset class="moz-mime-attachment-header"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
MapServer-dev mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext"
        href="mailto:MapServer-dev@lists.osgeo.org"
        moz-do-not-send="true">MapServer-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext"
        href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev"
        moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a>
</pre>
      </blockquote>
      <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com"
      moz-do-not-send="true">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
MapServer-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:MapServer-dev@lists.osgeo.org">MapServer-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/mapserver-dev">https://lists.osgeo.org/mailman/listinfo/mapserver-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>