[DOC-CVS] [doc-en] master: document the *MARK verb in PCRE

[email protected] (Karoly Negyesi)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Karoly Negyesi (chx)
Date: 2025-07-18T16:12:02+02:00

Commit: https://github.com/php/doc-en/commit/87cbbfc7a11e400715375f55900d0aaddfb3a934
Raw diff: https://github.com/php/doc-en/commit/87cbbfc7a11e400715375f55900d0aaddfb3a934.diff

document the *MARK verb in PCRE

Changed paths:
  M  reference/pcre/pattern.syntax.xml


Diff:

diff --git a/reference/pcre/pattern.syntax.xml b/reference/pcre/pattern.syntax.xml
index 563c1c8c24ad..51f06e96b33e 100644
--- a/reference/pcre/pattern.syntax.xml
+++ b/reference/pcre/pattern.syntax.xml
@@ -1311,6 +1311,17 @@
    rest of the main pattern as well as the alternative in the
    subpattern.
   </para>
+  <para>
+   It is possible to record which alternative was matched by using 
+   <literal>(*MARK:NAME)</literal> or <literal>(*:NAME)</literal>.
+   Any number of such <literal>(*MARK)</literal> verbs may appear and their
+   names do not have to be unique. When a match succeeds, the name of the
+   last-encountered <literal>(*MARK:NAME)</literal> will be placed among
+   matches as if it were a capture group called <literal>MARK</literal> so it
+   can be read from the <parameter>matches</parameter> of
+   <function>preg_match</function> and will be passed to the
+   <parameter>callback</parameter> of <function>preg_match_all</function> etc.
+  </para>
  </section>
 
  <section xml:id="regexp.reference.internal-options">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.