From 646ba2c4d05bf02216c0f7c40bb5f7307e7d8c16 Mon Sep 17 00:00:00 2001 From: Louis-Arnaud Date: Fri, 10 Jul 2026 13:58:54 +0200 Subject: [PATCH] ext/pcre: Document variable-length lookbehind and 128-char subpattern names (PCRE2 10.44) --- reference/pcre/pattern.syntax.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reference/pcre/pattern.syntax.xml b/reference/pcre/pattern.syntax.xml index f1315e2a0bab..ae3d1f5c9860 100644 --- a/reference/pcre/pattern.syntax.xml +++ b/reference/pcre/pattern.syntax.xml @@ -1510,6 +1510,10 @@ also by name. There are two alternative syntaxes (?<name>pattern) and (?'name'pattern). + + As of PHP 8.4.0, which bundles PCRE2 10.44, the maximum length of a + subpattern name is 128 characters; prior to PHP 8.4.0 it was 32 characters. + Sometimes it is necessary to have multiple matching, but alternating @@ -1915,6 +1919,14 @@ at the ends of strings; an example is given at the end of the section on once-only subpatterns. + + The fixed-length restriction described above applies prior to PHP 8.4.0. + As of PHP 8.4.0, which bundles PCRE2 10.44, a lookbehind assertion may match + strings of variable length: alternatives of differing lengths (such as + (?<!dogs?|cats?)) and top-level branches that can match + more than one length (such as (?<=ab(c|de))) are now + permitted, up to an implementation-defined maximum length. + Several assertions (of any sort) may occur in succession. For example,