[pcre-dev] [Bug 2761] DFA partial matching does not yield sa…

Startseite
Nachricht löschen
Autor: admin
Datum:  
To: pcre-dev
Betreff: [pcre-dev] [Bug 2761] DFA partial matching does not yield same results as non-partial
https://bugs.exim.org/show_bug.cgi?id=2761

Philip Hazel <Philip.Hazel@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED


--- Comment #1 from Philip Hazel <Philip.Hazel@???> ---
I have finally got round to analyzing your issue, and I'm afraid the news is
bad. The documentation does try to explain how the DFA "restart" feature works.
Unfortunately, it is not what you might expect. The documentation says this:

"PCRE2 does not retain the previously partially-matched string." and "only
those alternatives that match at one point in the subject are remembered"

After your first call partially matches "<foo ", a restart is committed either
to complete the match, or to give "no match". What it cannot do is abandon the
match attempt that starts at "<" and move on to the next character (it doesn't
have the next character).

For multi-segment matching it is probably best not to make use of the "restart"
feature at all, but instead to retain the partially matched string and do a
normal match when some more text has been joined on. You can do this with DFA
or non-DFA matching.

(In retrospect, the restart feature is perhaps not the cleverest of ideas.)

--
You are receiving this mail because:
You are on the CC list for the bug.