• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<title>pcre2syntax specification</title>
4</head>
5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6<h1>pcre2syntax man page</h1>
7<p>
8Return to the <a href="index.html">PCRE2 index page</a>.
9</p>
10<p>
11This page is part of the PCRE2 HTML documentation. It was generated
12automatically from the original man page. If there is any nonsense in it,
13please consult the man page, in case the conversion went wrong.
14<br>
15<ul>
16<li><a name="TOC1" href="#SEC1">PCRE2 REGULAR EXPRESSION SYNTAX SUMMARY</a>
17<li><a name="TOC2" href="#SEC2">QUOTING</a>
18<li><a name="TOC3" href="#SEC3">ESCAPED CHARACTERS</a>
19<li><a name="TOC4" href="#SEC4">CHARACTER TYPES</a>
20<li><a name="TOC5" href="#SEC5">GENERAL CATEGORY PROPERTIES FOR \p and \P</a>
21<li><a name="TOC6" href="#SEC6">PCRE2 SPECIAL CATEGORY PROPERTIES FOR \p and \P</a>
22<li><a name="TOC7" href="#SEC7">SCRIPT NAMES FOR \p AND \P</a>
23<li><a name="TOC8" href="#SEC8">CHARACTER CLASSES</a>
24<li><a name="TOC9" href="#SEC9">QUANTIFIERS</a>
25<li><a name="TOC10" href="#SEC10">ANCHORS AND SIMPLE ASSERTIONS</a>
26<li><a name="TOC11" href="#SEC11">REPORTED MATCH POINT SETTING</a>
27<li><a name="TOC12" href="#SEC12">ALTERNATION</a>
28<li><a name="TOC13" href="#SEC13">CAPTURING</a>
29<li><a name="TOC14" href="#SEC14">ATOMIC GROUPS</a>
30<li><a name="TOC15" href="#SEC15">COMMENT</a>
31<li><a name="TOC16" href="#SEC16">OPTION SETTING</a>
32<li><a name="TOC17" href="#SEC17">NEWLINE CONVENTION</a>
33<li><a name="TOC18" href="#SEC18">WHAT \R MATCHES</a>
34<li><a name="TOC19" href="#SEC19">LOOKAHEAD AND LOOKBEHIND ASSERTIONS</a>
35<li><a name="TOC20" href="#SEC20">NON-ATOMIC LOOKAROUND ASSERTIONS</a>
36<li><a name="TOC21" href="#SEC21">SCRIPT RUNS</a>
37<li><a name="TOC22" href="#SEC22">BACKREFERENCES</a>
38<li><a name="TOC23" href="#SEC23">SUBROUTINE REFERENCES (POSSIBLY RECURSIVE)</a>
39<li><a name="TOC24" href="#SEC24">CONDITIONAL PATTERNS</a>
40<li><a name="TOC25" href="#SEC25">BACKTRACKING CONTROL</a>
41<li><a name="TOC26" href="#SEC26">CALLOUTS</a>
42<li><a name="TOC27" href="#SEC27">SEE ALSO</a>
43<li><a name="TOC28" href="#SEC28">AUTHOR</a>
44<li><a name="TOC29" href="#SEC29">REVISION</a>
45</ul>
46<br><a name="SEC1" href="#TOC1">PCRE2 REGULAR EXPRESSION SYNTAX SUMMARY</a><br>
47<P>
48The full syntax and semantics of the regular expressions that are supported by
49PCRE2 are described in the
50<a href="pcre2pattern.html"><b>pcre2pattern</b></a>
51documentation. This document contains a quick-reference summary of the syntax.
52</P>
53<br><a name="SEC2" href="#TOC1">QUOTING</a><br>
54<P>
55<pre>
56  \x         where x is non-alphanumeric is a literal x
57  \Q...\E    treat enclosed characters as literal
58</PRE>
59</P>
60<br><a name="SEC3" href="#TOC1">ESCAPED CHARACTERS</a><br>
61<P>
62This table applies to ASCII and Unicode environments. An unrecognized escape
63sequence causes an error.
64<pre>
65  \a         alarm, that is, the BEL character (hex 07)
66  \cx        "control-x", where x is any ASCII printing character
67  \e         escape (hex 1B)
68  \f         form feed (hex 0C)
69  \n         newline (hex 0A)
70  \r         carriage return (hex 0D)
71  \t         tab (hex 09)
72  \0dd       character with octal code 0dd
73  \ddd       character with octal code ddd, or backreference
74  \o{ddd..}  character with octal code ddd..
75  \N{U+hh..} character with Unicode code point hh.. (Unicode mode only)
76  \xhh       character with hex code hh
77  \x{hh..}   character with hex code hh..
78</pre>
79If PCRE2_ALT_BSUX or PCRE2_EXTRA_ALT_BSUX is set ("ALT_BSUX mode"), the
80following are also recognized:
81<pre>
82  \U         the character "U"
83  \uhhhh     character with hex code hhhh
84  \u{hh..}   character with hex code hh.. but only for EXTRA_ALT_BSUX
85</pre>
86When \x is not followed by {, from zero to two hexadecimal digits are read,
87but in ALT_BSUX mode \x must be followed by two hexadecimal digits to be
88recognized as a hexadecimal escape; otherwise it matches a literal "x".
89Likewise, if \u (in ALT_BSUX mode) is not followed by four hexadecimal digits
90or (in EXTRA_ALT_BSUX mode) a sequence of hex digits in curly brackets, it
91matches a literal "u".
92</P>
93<P>
94Note that \0dd is always an octal code. The treatment of backslash followed by
95a non-zero digit is complicated; for details see the section
96<a href="pcre2pattern.html#digitsafterbackslash">"Non-printing characters"</a>
97in the
98<a href="pcre2pattern.html"><b>pcre2pattern</b></a>
99documentation, where details of escape processing in EBCDIC environments are
100also given. \N{U+hh..} is synonymous with \x{hh..} in PCRE2 but is not
101supported in EBCDIC environments. Note that \N not followed by an opening
102curly bracket has a different meaning (see below).
103</P>
104<br><a name="SEC4" href="#TOC1">CHARACTER TYPES</a><br>
105<P>
106<pre>
107  .          any character except newline;
108               in dotall mode, any character whatsoever
109  \C         one code unit, even in UTF mode (best avoided)
110  \d         a decimal digit
111  \D         a character that is not a decimal digit
112  \h         a horizontal white space character
113  \H         a character that is not a horizontal white space character
114  \N         a character that is not a newline
115  \p{<i>xx</i>}     a character with the <i>xx</i> property
116  \P{<i>xx</i>}     a character without the <i>xx</i> property
117  \R         a newline sequence
118  \s         a white space character
119  \S         a character that is not a white space character
120  \v         a vertical white space character
121  \V         a character that is not a vertical white space character
122  \w         a "word" character
123  \W         a "non-word" character
124  \X         a Unicode extended grapheme cluster
125</pre>
126\C is dangerous because it may leave the current matching point in the middle
127of a UTF-8 or UTF-16 character. The application can lock out the use of \C by
128setting the PCRE2_NEVER_BACKSLASH_C option. It is also possible to build PCRE2
129with the use of \C permanently disabled.
130</P>
131<P>
132By default, \d, \s, and \w match only ASCII characters, even in UTF-8 mode
133or in the 16-bit and 32-bit libraries. However, if locale-specific matching is
134happening, \s and \w may also match characters with code points in the range
135128-255. If the PCRE2_UCP option is set, the behaviour of these escape
136sequences is changed to use Unicode properties and they match many more
137characters.
138</P>
139<br><a name="SEC5" href="#TOC1">GENERAL CATEGORY PROPERTIES FOR \p and \P</a><br>
140<P>
141<pre>
142  C          Other
143  Cc         Control
144  Cf         Format
145  Cn         Unassigned
146  Co         Private use
147  Cs         Surrogate
148
149  L          Letter
150  Ll         Lower case letter
151  Lm         Modifier letter
152  Lo         Other letter
153  Lt         Title case letter
154  Lu         Upper case letter
155  L&         Ll, Lu, or Lt
156
157  M          Mark
158  Mc         Spacing mark
159  Me         Enclosing mark
160  Mn         Non-spacing mark
161
162  N          Number
163  Nd         Decimal number
164  Nl         Letter number
165  No         Other number
166
167  P          Punctuation
168  Pc         Connector punctuation
169  Pd         Dash punctuation
170  Pe         Close punctuation
171  Pf         Final punctuation
172  Pi         Initial punctuation
173  Po         Other punctuation
174  Ps         Open punctuation
175
176  S          Symbol
177  Sc         Currency symbol
178  Sk         Modifier symbol
179  Sm         Mathematical symbol
180  So         Other symbol
181
182  Z          Separator
183  Zl         Line separator
184  Zp         Paragraph separator
185  Zs         Space separator
186</PRE>
187</P>
188<br><a name="SEC6" href="#TOC1">PCRE2 SPECIAL CATEGORY PROPERTIES FOR \p and \P</a><br>
189<P>
190<pre>
191  Xan        Alphanumeric: union of properties L and N
192  Xps        POSIX space: property Z or tab, NL, VT, FF, CR
193  Xsp        Perl space: property Z or tab, NL, VT, FF, CR
194  Xuc        Univerally-named character: one that can be
195               represented by a Universal Character Name
196  Xwd        Perl word: property Xan or underscore
197</pre>
198Perl and POSIX space are now the same. Perl added VT to its space character set
199at release 5.18.
200</P>
201<br><a name="SEC7" href="#TOC1">SCRIPT NAMES FOR \p AND \P</a><br>
202<P>
203Adlam,
204Ahom,
205Anatolian_Hieroglyphs,
206Arabic,
207Armenian,
208Avestan,
209Balinese,
210Bamum,
211Bassa_Vah,
212Batak,
213Bengali,
214Bhaiksuki,
215Bopomofo,
216Brahmi,
217Braille,
218Buginese,
219Buhid,
220Canadian_Aboriginal,
221Carian,
222Caucasian_Albanian,
223Chakma,
224Cham,
225Cherokee,
226Chorasmian,
227Common,
228Coptic,
229Cuneiform,
230Cypriot,
231Cypro_Minoan,
232Cyrillic,
233Deseret,
234Devanagari,
235Dives_Akuru,
236Dogra,
237Duployan,
238Egyptian_Hieroglyphs,
239Elbasan,
240Elymaic,
241Ethiopic,
242Georgian,
243Glagolitic,
244Gothic,
245Grantha,
246Greek,
247Gujarati,
248Gunjala_Gondi,
249Gurmukhi,
250Han,
251Hangul,
252Hanifi_Rohingya,
253Hanunoo,
254Hatran,
255Hebrew,
256Hiragana,
257Imperial_Aramaic,
258Inherited,
259Inscriptional_Pahlavi,
260Inscriptional_Parthian,
261Javanese,
262Kaithi,
263Kannada,
264Katakana,
265Kayah_Li,
266Kharoshthi,
267Khitan_Small_Script,
268Khmer,
269Khojki,
270Khudawadi,
271Lao,
272Latin,
273Lepcha,
274Limbu,
275Linear_A,
276Linear_B,
277Lisu,
278Lycian,
279Lydian,
280Mahajani,
281Makasar,
282Malayalam,
283Mandaic,
284Manichaean,
285Marchen,
286Masaram_Gondi,
287Medefaidrin,
288Meetei_Mayek,
289Mende_Kikakui,
290Meroitic_Cursive,
291Meroitic_Hieroglyphs,
292Miao,
293Modi,
294Mongolian,
295Mro,
296Multani,
297Myanmar,
298Nabataean,
299Nandinagari,
300New_Tai_Lue,
301Newa,
302Nko,
303Nushu,
304Nyakeng_Puachue_Hmong,
305Ogham,
306Ol_Chiki,
307Old_Hungarian,
308Old_Italic,
309Old_North_Arabian,
310Old_Permic,
311Old_Persian,
312Old_Sogdian,
313Old_South_Arabian,
314Old_Turkic,
315Old_Uyghur,
316Oriya,
317Osage,
318Osmanya,
319Pahawh_Hmong,
320Palmyrene,
321Pau_Cin_Hau,
322Phags_Pa,
323Phoenician,
324Psalter_Pahlavi,
325Rejang,
326Runic,
327Samaritan,
328Saurashtra,
329Sharada,
330Shavian,
331Siddham,
332SignWriting,
333Sinhala,
334Sogdian,
335Sora_Sompeng,
336Soyombo,
337Sundanese,
338Syloti_Nagri,
339Syriac,
340Tagalog,
341Tagbanwa,
342Tai_Le,
343Tai_Tham,
344Tai_Viet,
345Takri,
346Tamil,
347Tangsa,
348Tangut,
349Telugu,
350Thaana,
351Thai,
352Tibetan,
353Tifinagh,
354Tirhuta,
355Toto,
356Ugaritic,
357Vai,
358Vithkuqi,
359Wancho,
360Warang_Citi,
361Yezidi,
362Yi,
363Zanabazar_Square.
364</P>
365<br><a name="SEC8" href="#TOC1">CHARACTER CLASSES</a><br>
366<P>
367<pre>
368  [...]       positive character class
369  [^...]      negative character class
370  [x-y]       range (can be used for hex characters)
371  [[:xxx:]]   positive POSIX named set
372  [[:^xxx:]]  negative POSIX named set
373
374  alnum       alphanumeric
375  alpha       alphabetic
376  ascii       0-127
377  blank       space or tab
378  cntrl       control character
379  digit       decimal digit
380  graph       printing, excluding space
381  lower       lower case letter
382  print       printing, including space
383  punct       printing, excluding alphanumeric
384  space       white space
385  upper       upper case letter
386  word        same as \w
387  xdigit      hexadecimal digit
388</pre>
389In PCRE2, POSIX character set names recognize only ASCII characters by default,
390but some of them use Unicode properties if PCRE2_UCP is set. You can use
391\Q...\E inside a character class.
392</P>
393<br><a name="SEC9" href="#TOC1">QUANTIFIERS</a><br>
394<P>
395<pre>
396  ?           0 or 1, greedy
397  ?+          0 or 1, possessive
398  ??          0 or 1, lazy
399  *           0 or more, greedy
400  *+          0 or more, possessive
401  *?          0 or more, lazy
402  +           1 or more, greedy
403  ++          1 or more, possessive
404  +?          1 or more, lazy
405  {n}         exactly n
406  {n,m}       at least n, no more than m, greedy
407  {n,m}+      at least n, no more than m, possessive
408  {n,m}?      at least n, no more than m, lazy
409  {n,}        n or more, greedy
410  {n,}+       n or more, possessive
411  {n,}?       n or more, lazy
412</PRE>
413</P>
414<br><a name="SEC10" href="#TOC1">ANCHORS AND SIMPLE ASSERTIONS</a><br>
415<P>
416<pre>
417  \b          word boundary
418  \B          not a word boundary
419  ^           start of subject
420                also after an internal newline in multiline mode
421                (after any newline if PCRE2_ALT_CIRCUMFLEX is set)
422  \A          start of subject
423  $           end of subject
424                also before newline at end of subject
425                also before internal newline in multiline mode
426  \Z          end of subject
427                also before newline at end of subject
428  \z          end of subject
429  \G          first matching position in subject
430</PRE>
431</P>
432<br><a name="SEC11" href="#TOC1">REPORTED MATCH POINT SETTING</a><br>
433<P>
434<pre>
435  \K          set reported start of match
436</pre>
437From release 10.38 \K is not permitted by default in lookaround assertions,
438for compatibility with Perl. However, if the PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
439option is set, the previous behaviour is re-enabled. When this option is set,
440\K is honoured in positive assertions, but ignored in negative ones.
441</P>
442<br><a name="SEC12" href="#TOC1">ALTERNATION</a><br>
443<P>
444<pre>
445  expr|expr|expr...
446</PRE>
447</P>
448<br><a name="SEC13" href="#TOC1">CAPTURING</a><br>
449<P>
450<pre>
451  (...)           capture group
452  (?&#60;name&#62;...)    named capture group (Perl)
453  (?'name'...)    named capture group (Perl)
454  (?P&#60;name&#62;...)   named capture group (Python)
455  (?:...)         non-capture group
456  (?|...)         non-capture group; reset group numbers for
457                   capture groups in each alternative
458</pre>
459In non-UTF modes, names may contain underscores and ASCII letters and digits;
460in UTF modes, any Unicode letters and Unicode decimal digits are permitted. In
461both cases, a name must not start with a digit.
462</P>
463<br><a name="SEC14" href="#TOC1">ATOMIC GROUPS</a><br>
464<P>
465<pre>
466  (?&#62;...)         atomic non-capture group
467  (*atomic:...)   atomic non-capture group
468</PRE>
469</P>
470<br><a name="SEC15" href="#TOC1">COMMENT</a><br>
471<P>
472<pre>
473  (?#....)        comment (not nestable)
474</PRE>
475</P>
476<br><a name="SEC16" href="#TOC1">OPTION SETTING</a><br>
477<P>
478Changes of these options within a group are automatically cancelled at the end
479of the group.
480<pre>
481  (?i)            caseless
482  (?J)            allow duplicate named groups
483  (?m)            multiline
484  (?n)            no auto capture
485  (?s)            single line (dotall)
486  (?U)            default ungreedy (lazy)
487  (?x)            extended: ignore white space except in classes
488  (?xx)           as (?x) but also ignore space and tab in classes
489  (?-...)         unset option(s)
490  (?^)            unset imnsx options
491</pre>
492Unsetting x or xx unsets both. Several options may be set at once, and a
493mixture of setting and unsetting such as (?i-x) is allowed, but there may be
494only one hyphen. Setting (but no unsetting) is allowed after (?^ for example
495(?^in). An option setting may appear at the start of a non-capture group, for
496example (?i:...).
497</P>
498<P>
499The following are recognized only at the very start of a pattern or after one
500of the newline or \R options with similar syntax. More than one of them may
501appear. For the first three, d is a decimal number.
502<pre>
503  (*LIMIT_DEPTH=d) set the backtracking limit to d
504  (*LIMIT_HEAP=d)  set the heap size limit to d * 1024 bytes
505  (*LIMIT_MATCH=d) set the match limit to d
506  (*NOTEMPTY)      set PCRE2_NOTEMPTY when matching
507  (*NOTEMPTY_ATSTART) set PCRE2_NOTEMPTY_ATSTART when matching
508  (*NO_AUTO_POSSESS) no auto-possessification (PCRE2_NO_AUTO_POSSESS)
509  (*NO_DOTSTAR_ANCHOR) no .* anchoring (PCRE2_NO_DOTSTAR_ANCHOR)
510  (*NO_JIT)       disable JIT optimization
511  (*NO_START_OPT) no start-match optimization (PCRE2_NO_START_OPTIMIZE)
512  (*UTF)          set appropriate UTF mode for the library in use
513  (*UCP)          set PCRE2_UCP (use Unicode properties for \d etc)
514</pre>
515Note that LIMIT_DEPTH, LIMIT_HEAP, and LIMIT_MATCH can only reduce the value of
516the limits set by the caller of <b>pcre2_match()</b> or <b>pcre2_dfa_match()</b>,
517not increase them. LIMIT_RECURSION is an obsolete synonym for LIMIT_DEPTH. The
518application can lock out the use of (*UTF) and (*UCP) by setting the
519PCRE2_NEVER_UTF or PCRE2_NEVER_UCP options, respectively, at compile time.
520</P>
521<br><a name="SEC17" href="#TOC1">NEWLINE CONVENTION</a><br>
522<P>
523These are recognized only at the very start of the pattern or after option
524settings with a similar syntax.
525<pre>
526  (*CR)           carriage return only
527  (*LF)           linefeed only
528  (*CRLF)         carriage return followed by linefeed
529  (*ANYCRLF)      all three of the above
530  (*ANY)          any Unicode newline sequence
531  (*NUL)          the NUL character (binary zero)
532</PRE>
533</P>
534<br><a name="SEC18" href="#TOC1">WHAT \R MATCHES</a><br>
535<P>
536These are recognized only at the very start of the pattern or after option
537setting with a similar syntax.
538<pre>
539  (*BSR_ANYCRLF)  CR, LF, or CRLF
540  (*BSR_UNICODE)  any Unicode newline sequence
541</PRE>
542</P>
543<br><a name="SEC19" href="#TOC1">LOOKAHEAD AND LOOKBEHIND ASSERTIONS</a><br>
544<P>
545<pre>
546  (?=...)                     )
547  (*pla:...)                  ) positive lookahead
548  (*positive_lookahead:...)   )
549
550  (?!...)                     )
551  (*nla:...)                  ) negative lookahead
552  (*negative_lookahead:...)   )
553
554  (?&#60;=...)                    )
555  (*plb:...)                  ) positive lookbehind
556  (*positive_lookbehind:...)  )
557
558  (?&#60;!...)                    )
559  (*nlb:...)                  ) negative lookbehind
560  (*negative_lookbehind:...)  )
561</pre>
562Each top-level branch of a lookbehind must be of a fixed length.
563</P>
564<br><a name="SEC20" href="#TOC1">NON-ATOMIC LOOKAROUND ASSERTIONS</a><br>
565<P>
566These assertions are specific to PCRE2 and are not Perl-compatible.
567<pre>
568  (?*...)                                )
569  (*napla:...)                           ) synonyms
570  (*non_atomic_positive_lookahead:...)   )
571
572  (?&#60;*...)                               )
573  (*naplb:...)                           ) synonyms
574  (*non_atomic_positive_lookbehind:...)  )
575</PRE>
576</P>
577<br><a name="SEC21" href="#TOC1">SCRIPT RUNS</a><br>
578<P>
579<pre>
580  (*script_run:...)           ) script run, can be backtracked into
581  (*sr:...)                   )
582
583  (*atomic_script_run:...)    ) atomic script run
584  (*asr:...)                  )
585</PRE>
586</P>
587<br><a name="SEC22" href="#TOC1">BACKREFERENCES</a><br>
588<P>
589<pre>
590  \n              reference by number (can be ambiguous)
591  \gn             reference by number
592  \g{n}           reference by number
593  \g+n            relative reference by number (PCRE2 extension)
594  \g-n            relative reference by number
595  \g{+n}          relative reference by number (PCRE2 extension)
596  \g{-n}          relative reference by number
597  \k&#60;name&#62;        reference by name (Perl)
598  \k'name'        reference by name (Perl)
599  \g{name}        reference by name (Perl)
600  \k{name}        reference by name (.NET)
601  (?P=name)       reference by name (Python)
602</PRE>
603</P>
604<br><a name="SEC23" href="#TOC1">SUBROUTINE REFERENCES (POSSIBLY RECURSIVE)</a><br>
605<P>
606<pre>
607  (?R)            recurse whole pattern
608  (?n)            call subroutine by absolute number
609  (?+n)           call subroutine by relative number
610  (?-n)           call subroutine by relative number
611  (?&name)        call subroutine by name (Perl)
612  (?P&#62;name)       call subroutine by name (Python)
613  \g&#60;name&#62;        call subroutine by name (Oniguruma)
614  \g'name'        call subroutine by name (Oniguruma)
615  \g&#60;n&#62;           call subroutine by absolute number (Oniguruma)
616  \g'n'           call subroutine by absolute number (Oniguruma)
617  \g&#60;+n&#62;          call subroutine by relative number (PCRE2 extension)
618  \g'+n'          call subroutine by relative number (PCRE2 extension)
619  \g&#60;-n&#62;          call subroutine by relative number (PCRE2 extension)
620  \g'-n'          call subroutine by relative number (PCRE2 extension)
621</PRE>
622</P>
623<br><a name="SEC24" href="#TOC1">CONDITIONAL PATTERNS</a><br>
624<P>
625<pre>
626  (?(condition)yes-pattern)
627  (?(condition)yes-pattern|no-pattern)
628
629  (?(n)               absolute reference condition
630  (?(+n)              relative reference condition
631  (?(-n)              relative reference condition
632  (?(&#60;name&#62;)          named reference condition (Perl)
633  (?('name')          named reference condition (Perl)
634  (?(name)            named reference condition (PCRE2, deprecated)
635  (?(R)               overall recursion condition
636  (?(Rn)              specific numbered group recursion condition
637  (?(R&name)          specific named group recursion condition
638  (?(DEFINE)          define groups for reference
639  (?(VERSION[&#62;]=n.m)  test PCRE2 version
640  (?(assert)          assertion condition
641</pre>
642Note the ambiguity of (?(R) and (?(Rn) which might be named reference
643conditions or recursion tests. Such a condition is interpreted as a reference
644condition if the relevant named group exists.
645</P>
646<br><a name="SEC25" href="#TOC1">BACKTRACKING CONTROL</a><br>
647<P>
648All backtracking control verbs may be in the form (*VERB:NAME). For (*MARK) the
649name is mandatory, for the others it is optional. (*SKIP) changes its behaviour
650if :NAME is present. The others just set a name for passing back to the caller,
651but this is not a name that (*SKIP) can see. The following act immediately they
652are reached:
653<pre>
654  (*ACCEPT)       force successful match
655  (*FAIL)         force backtrack; synonym (*F)
656  (*MARK:NAME)    set name to be passed back; synonym (*:NAME)
657</pre>
658The following act only when a subsequent match failure causes a backtrack to
659reach them. They all force a match failure, but they differ in what happens
660afterwards. Those that advance the start-of-match point do so only if the
661pattern is not anchored.
662<pre>
663  (*COMMIT)       overall failure, no advance of starting point
664  (*PRUNE)        advance to next starting character
665  (*SKIP)         advance to current matching position
666  (*SKIP:NAME)    advance to position corresponding to an earlier
667                  (*MARK:NAME); if not found, the (*SKIP) is ignored
668  (*THEN)         local failure, backtrack to next alternation
669</pre>
670The effect of one of these verbs in a group called as a subroutine is confined
671to the subroutine call.
672</P>
673<br><a name="SEC26" href="#TOC1">CALLOUTS</a><br>
674<P>
675<pre>
676  (?C)            callout (assumed number 0)
677  (?Cn)           callout with numerical data n
678  (?C"text")      callout with string data
679</pre>
680The allowed string delimiters are ` ' " ^ % # $ (which are the same for the
681start and the end), and the starting delimiter { matched with the ending
682delimiter }. To encode the ending delimiter within the string, double it.
683</P>
684<br><a name="SEC27" href="#TOC1">SEE ALSO</a><br>
685<P>
686<b>pcre2pattern</b>(3), <b>pcre2api</b>(3), <b>pcre2callout</b>(3),
687<b>pcre2matching</b>(3), <b>pcre2</b>(3).
688</P>
689<br><a name="SEC28" href="#TOC1">AUTHOR</a><br>
690<P>
691Philip Hazel
692<br>
693Retired from University Computing Service
694<br>
695Cambridge, England.
696<br>
697</P>
698<br><a name="SEC29" href="#TOC1">REVISION</a><br>
699<P>
700Last updated: 30 August 2021
701<br>
702Copyright &copy; 1997-2021 University of Cambridge.
703<br>
704<p>
705Return to the <a href="index.html">PCRE2 index page</a>.
706</p>
707