From f9bf060b866081dba3f768425932e59012d4b3d6 Mon Sep 17 00:00:00 2001 From: David de Hilster Date: Wed, 14 Oct 2026 19:31:04 -0400 Subject: [PATCH] Help: how a wildcard stops before optional and later elements (engine 4.2.27, #427) Co-Authored-By: Claude Opus 5.5 --- Help/markdown/_xWILD.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Help/markdown/_xWILD.md b/Help/markdown/_xWILD.md index fe4aad8..3d78720 100644 --- a/Help/markdown/_xWILD.md +++ b/Help/markdown/_xWILD.md @@ -10,6 +10,18 @@ Match anything.  _xWILD is an unrestricted wildcard. Key-value pairs may add re With a match or fail list, _xWILD becomes an "OR" matching function. +An unrestricted _xWILD covers nodes up to the first node that the elements after it can match. Matching never backs up to try a longer stretch, so a wildcard stops at the first possible place. + +When an optional element follows the wildcard, the wildcard also stops at the first node that a later element matches, up to and including the next required element. In that case the optional element is absent. In + +``` +_xNIL <- the _xWILD _xWILD [opt match=(three)] _xWILD [one match=(bears)] @@ +``` + +on "the big bears met three bears", the wildcard covers only "big" and "three" is absent, so the rule matches "the big bears". When the optional element and a later one both match the same node, the optional element is used. Before engine 4.2.27 the wildcard ran past the first "bears" to reach "three". Here the rule then failed, because "three" is followed by a space, not "bears". To stop the wildcard, a rule had to repeat the later elements in a fail list, as in `_xWILD [fail=(three bears)]`. + +**NEW 4.2.27** + ## Example ```