Skip to content

Commit 87cbbfc

Browse files
committed
document the *MARK verb in PCRE
1 parent e8600fe commit 87cbbfc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

reference/pcre/pattern.syntax.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,17 @@
13111311
rest of the main pattern as well as the alternative in the
13121312
subpattern.
13131313
</para>
1314+
<para>
1315+
It is possible to record which alternative was matched by using
1316+
<literal>(*MARK:NAME)</literal> or <literal>(*:NAME)</literal>.
1317+
Any number of such <literal>(*MARK)</literal> verbs may appear and their
1318+
names do not have to be unique. When a match succeeds, the name of the
1319+
last-encountered <literal>(*MARK:NAME)</literal> will be placed among
1320+
matches as if it were a capture group called <literal>MARK</literal> so it
1321+
can be read from the <parameter>matches</parameter> of
1322+
<function>preg_match</function> and will be passed to the
1323+
<parameter>callback</parameter> of <function>preg_match_all</function> etc.
1324+
</para>
13141325
</section>
13151326

13161327
<section xml:id="regexp.reference.internal-options">

0 commit comments

Comments
 (0)