3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Perl Regular Expression Syntax</title>
5 <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Boost.Regex 5.1.4">
8 <link rel="up" href="../syntax.html" title="Regular Expression Syntax">
9 <link rel="prev" href="../syntax.html" title="Regular Expression Syntax">
10 <link rel="next" href="basic_extended.html" title="POSIX Extended Regular Expression Syntax">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../syntax.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="basic_extended.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="boost_regex.syntax.perl_syntax"></a><a class="link" href="perl_syntax.html" title="Perl Regular Expression Syntax">Perl Regular Expression
29 </h3></div></div></div>
31 <a name="boost_regex.syntax.perl_syntax.h0"></a>
32 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.synopsis"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.synopsis">Synopsis</a>
35 The Perl regular expression syntax is based on that used by the programming
36 language Perl . Perl regular expressions are the default behavior in Boost.Regex
37 or you can pass the flag <code class="literal">perl</code> to the <a class="link" href="../ref/basic_regex.html" title="basic_regex"><code class="computeroutput"><span class="identifier">basic_regex</span></code></a> constructor, for example:
39 <pre class="programlisting"><span class="comment">// e1 is a case sensitive Perl regular expression: </span>
40 <span class="comment">// since Perl is the default option there's no need to explicitly specify the syntax used here:</span>
41 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e1</span><span class="special">(</span><span class="identifier">my_expression</span><span class="special">);</span>
42 <span class="comment">// e2 a case insensitive Perl regular expression:</span>
43 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e2</span><span class="special">(</span><span class="identifier">my_expression</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span><span class="special">::</span><span class="identifier">perl</span><span class="special">|</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span><span class="special">::</span><span class="identifier">icase</span><span class="special">);</span>
46 <a name="boost_regex.syntax.perl_syntax.h1"></a>
47 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.perl_regular_expression_syntax"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.perl_regular_expression_syntax">Perl
48 Regular Expression Syntax</a>
51 In Perl regular expressions, all characters match themselves except for the
52 following special characters:
54 <pre class="programlisting">.[{}()\*+?|^$</pre>
56 Other characters are special only in certain situations - for example <code class="computeroutput"><span class="special">]</span></code> is special only after an opening <code class="computeroutput"><span class="special">[</span></code>.
59 <a name="boost_regex.syntax.perl_syntax.h2"></a>
60 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.wildcard"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.wildcard">Wildcard</a>
63 The single character '.' when used outside of a character set will match
64 any single character except:
66 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
68 The NULL character when the <a class="link" href="../ref/match_flag_type.html" title="match_flag_type">flag
69 <code class="literal">match_not_dot_null</code></a> is passed to the matching
73 The newline character when the <a class="link" href="../ref/match_flag_type.html" title="match_flag_type">flag
74 <code class="literal">match_not_dot_newline</code></a> is passed to the matching
79 <a name="boost_regex.syntax.perl_syntax.h3"></a>
80 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.anchors"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.anchors">Anchors</a>
83 A '^' character shall match the start of a line.
86 A '$' character shall match the end of a line.
89 <a name="boost_regex.syntax.perl_syntax.h4"></a>
90 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.marked_sub_expressions"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.marked_sub_expressions">Marked sub-expressions</a>
93 A section beginning <code class="literal">(</code> and ending <code class="literal">)</code>
94 acts as a marked sub-expression. Whatever matched the sub-expression is split
95 out in a separate field by the matching algorithms. Marked sub-expressions
96 can also repeated, or referred to by a back-reference.
99 <a name="boost_regex.syntax.perl_syntax.h5"></a>
100 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.non_marking_grouping"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.non_marking_grouping">Non-marking
104 A marked sub-expression is useful to lexically group part of a regular expression,
105 but has the side-effect of spitting out an extra field in the result. As
106 an alternative you can lexically group part of a regular expression, without
107 generating a marked sub-expression by using <code class="literal">(?:</code> and <code class="literal">)</code>
108 , for example <code class="literal">(?:ab)+</code> will repeat <code class="literal">ab</code>
109 without splitting out any separate sub-expressions.
112 <a name="boost_regex.syntax.perl_syntax.h6"></a>
113 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.repeats"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.repeats">Repeats</a>
116 Any atom (a single character, a marked sub-expression, or a character class)
117 can be repeated with the <code class="literal">*</code>, <code class="literal">+</code>, <code class="literal">?</code>,
118 and <code class="literal">{}</code> operators.
121 The <code class="literal">*</code> operator will match the preceding atom zero or more
122 times, for example the expression <code class="literal">a*b</code> will match any of
125 <pre class="programlisting"><span class="identifier">b</span>
126 <span class="identifier">ab</span>
127 <span class="identifier">aaaaaaaab</span>
130 The <code class="literal">+</code> operator will match the preceding atom one or more
131 times, for example the expression <code class="literal">a+b</code> will match any of
134 <pre class="programlisting"><span class="identifier">ab</span>
135 <span class="identifier">aaaaaaaab</span>
140 <pre class="programlisting"><span class="identifier">b</span>
143 The <code class="literal">?</code> operator will match the preceding atom zero or one
144 times, for example the expression ca?b will match any of the following:
146 <pre class="programlisting"><span class="identifier">cb</span>
147 <span class="identifier">cab</span>
152 <pre class="programlisting"><span class="identifier">caab</span>
155 An atom can also be repeated with a bounded repeat:
158 <code class="literal">a{n}</code> Matches 'a' repeated exactly n times.
161 <code class="literal">a{n,}</code> Matches 'a' repeated n or more times.
164 <code class="literal">a{n, m}</code> Matches 'a' repeated between n and m times inclusive.
169 <pre class="programlisting">^a{2,3}$</pre>
171 Will match either of:
173 <pre class="programlisting"><span class="identifier">aa</span>
174 <span class="identifier">aaa</span>
179 <pre class="programlisting"><span class="identifier">a</span>
180 <span class="identifier">aaaa</span>
183 Note that the "{" and "}" characters will treated as
184 ordinary literals when used in a context that is not a repeat: this matches
185 Perl 5.x behavior. For example in the expressions "ab{1", "ab1}"
186 and "a{b}c" the curly brackets are all treated as literals and
187 <span class="emphasis"><em>no error will be raised</em></span>.
190 It is an error to use a repeat operator, if the preceding construct can not
191 be repeated, for example:
193 <pre class="programlisting"><span class="identifier">a</span><span class="special">(*)</span>
196 Will raise an error, as there is nothing for the <code class="literal">*</code> operator
200 <a name="boost_regex.syntax.perl_syntax.h7"></a>
201 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.non_greedy_repeats"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.non_greedy_repeats">Non
205 The normal repeat operators are "greedy", that is to say they will
206 consume as much input as possible. There are non-greedy versions available
207 that will consume as little input as possible while still producing a match.
210 <code class="literal">*?</code> Matches the previous atom zero or more times, while
211 consuming as little input as possible.
214 <code class="literal">+?</code> Matches the previous atom one or more times, while
215 consuming as little input as possible.
218 <code class="literal">??</code> Matches the previous atom zero or one times, while
219 consuming as little input as possible.
222 <code class="literal">{n,}?</code> Matches the previous atom n or more times, while
223 consuming as little input as possible.
226 <code class="literal">{n,m}?</code> Matches the previous atom between n and m times,
227 while consuming as little input as possible.
230 <a name="boost_regex.syntax.perl_syntax.h8"></a>
231 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.possessive_repeats"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.possessive_repeats">Possessive
235 By default when a repeated pattern does not match then the engine will backtrack
236 until a match is found. However, this behaviour can sometime be undesireble
237 so there are also "possessive" repeats: these match as much as
238 possible and do not then allow backtracking if the rest of the expression
242 <code class="literal">*+</code> Matches the previous atom zero or more times, while
246 <code class="literal">++</code> Matches the previous atom one or more times, while
250 <code class="literal">?+</code> Matches the previous atom zero or one times, while
254 <code class="literal">{n,}+</code> Matches the previous atom n or more times, while
258 <code class="literal">{n,m}+</code> Matches the previous atom between n and m times,
259 while giving nothing back.
262 <a name="boost_regex.syntax.perl_syntax.h9"></a>
263 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.back_references"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.back_references">Back
267 An escape character followed by a digit <span class="emphasis"><em>n</em></span>, where <span class="emphasis"><em>n</em></span>
268 is in the range 1-9, matches the same string that was matched by sub-expression
269 <span class="emphasis"><em>n</em></span>. For example the expression:
271 <pre class="programlisting">^(a*)[^a]*\1$</pre>
273 Will match the string:
275 <pre class="programlisting"><span class="identifier">aaabbaaa</span>
280 <pre class="programlisting"><span class="identifier">aaabba</span>
283 You can also use the \g escape for the same function, for example:
285 <div class="informaltable"><table class="table">
306 <code class="literal">\g1</code>
311 Match whatever matched sub-expression 1
318 <code class="literal">\g{1}</code>
323 Match whatever matched sub-expression 1: this form allows for safer
324 parsing of the expression in cases like <code class="literal">\g{1}2</code>
325 or for indexes higher than 9 as in <code class="literal">\g{1234}</code>
332 <code class="literal">\g-1</code>
337 Match whatever matched the last opened sub-expression
344 <code class="literal">\g{-2}</code>
349 Match whatever matched the last but one opened sub-expression
356 <code class="literal">\g{one}</code>
361 Match whatever matched the sub-expression named "one"
368 Finally the \k escape can be used to refer to named subexpressions, for example
369 <code class="literal">\k<two></code> will match whatever matched the subexpression
373 <a name="boost_regex.syntax.perl_syntax.h10"></a>
374 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.alternation"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.alternation">Alternation</a>
377 The <code class="literal">|</code> operator will match either of its arguments, so
378 for example: <code class="literal">abc|def</code> will match either "abc"
382 Parenthesis can be used to group alternations, for example: <code class="literal">ab(d|ef)</code>
383 will match either of "abd" or "abef".
386 Empty alternatives are not allowed (these are almost always a mistake), but
387 if you really want an empty alternative use <code class="literal">(?:)</code> as a
388 placeholder, for example:
391 <code class="literal">|abc</code> is not a valid expression, but
394 <code class="literal">(?:)|abc</code> is and is equivalent, also the expression:
397 <code class="literal">(?:abc)??</code> has exactly the same effect.
400 <a name="boost_regex.syntax.perl_syntax.h11"></a>
401 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.character_sets"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.character_sets">Character
405 A character set is a bracket-expression starting with <code class="literal">[] and ending
406 with <code class="literal"></code></code>, it defines a set of characters, and matches
407 any single character that is a member of that set.
410 A bracket expression may contain any combination of the following:
413 <a name="boost_regex.syntax.perl_syntax.h12"></a>
414 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.single_characters"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.single_characters">Single
418 For example <code class="literal">[abc]</code>, will match any of the characters 'a',
422 <a name="boost_regex.syntax.perl_syntax.h13"></a>
423 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.character_ranges"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.character_ranges">Character
427 For example <code class="literal">[a-c]</code> will match any single character in the
428 range 'a' to 'c'. By default, for Perl regular expressions, a character x
429 is within the range y to z, if the code point of the character lies within
430 the codepoints of the endpoints of the range. Alternatively, if you set the
431 <a class="link" href="../ref/syntax_option_type/syntax_option_type_perl.html" title="Options for Perl Regular Expressions"><code class="literal">collate</code>
432 flag</a> when constructing the regular expression, then ranges are locale
436 <a name="boost_regex.syntax.perl_syntax.h14"></a>
437 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.negation"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.negation">Negation</a>
440 If the bracket-expression begins with the ^ character, then it matches the
441 complement of the characters it contains, for example <code class="literal">[^a-c]</code>
442 matches any character that is not in the range <code class="literal">a-c</code>.
445 <a name="boost_regex.syntax.perl_syntax.h15"></a>
446 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.character_classes"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.character_classes">Character
450 An expression of the form <code class="literal">[[:name:]]</code> matches the named
451 character class "name", for example <code class="literal">[[:lower:]]</code>
452 matches any lower case character. See <a class="link" href="character_classes.html" title="Character Class Names">character
456 <a name="boost_regex.syntax.perl_syntax.h16"></a>
457 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.collating_elements"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.collating_elements">Collating
461 An expression of the form <code class="literal">[[.col.]]</code> matches the collating
462 element <span class="emphasis"><em>col</em></span>. A collating element is any single character,
463 or any sequence of characters that collates as a single unit. Collating elements
464 may also be used as the end point of a range, for example: <code class="literal">[[.ae.]-c]</code>
465 matches the character sequence "ae", plus any single character
466 in the range "ae"-c, assuming that "ae" is treated as
467 a single collating element in the current locale.
470 As an extension, a collating element may also be specified via it's <a class="link" href="collating_names.html" title="Collating Names">symbolic name</a>, for example:
472 <pre class="programlisting"><span class="special">[[.</span><span class="identifier">NUL</span><span class="special">.]]</span>
475 matches a <code class="literal">\0</code> character.
478 <a name="boost_regex.syntax.perl_syntax.h17"></a>
479 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.equivalence_classes"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.equivalence_classes">Equivalence
483 An expression of the form <code class="literal">[[=col=]]</code>, matches any character
484 or collating element whose primary sort key is the same as that for collating
485 element <span class="emphasis"><em>col</em></span>, as with collating elements the name <span class="emphasis"><em>col</em></span>
486 may be a <a class="link" href="collating_names.html" title="Collating Names">symbolic name</a>.
487 A primary sort key is one that ignores case, accentation, or locale-specific
488 tailorings; so for example <code class="computeroutput"><span class="special">[[=</span><span class="identifier">a</span><span class="special">=]]</span></code> matches
489 any of the characters: a, À, Á, Â, Ã, Ä, Å, A, à, á, â, ã, ä and å. Unfortunately implementation
490 of this is reliant on the platform's collation and localisation support;
491 this feature can not be relied upon to work portably across all platforms,
492 or even all locales on one platform.
495 <a name="boost_regex.syntax.perl_syntax.h18"></a>
496 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.escaped_characters"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.escaped_characters">Escaped
500 All the escape sequences that match a single character, or a single character
501 class are permitted within a character class definition. For example <code class="computeroutput"><span class="special">[\[\]]</span></code> would match either of <code class="computeroutput"><span class="special">[</span></code> or <code class="computeroutput"><span class="special">]</span></code>
502 while <code class="computeroutput"><span class="special">[\</span><span class="identifier">W</span><span class="special">\</span><span class="identifier">d</span><span class="special">]</span></code>
503 would match any character that is either a "digit", <span class="emphasis"><em>or</em></span>
504 is <span class="emphasis"><em>not</em></span> a "word" character.
507 <a name="boost_regex.syntax.perl_syntax.h19"></a>
508 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.combinations"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.combinations">Combinations</a>
511 All of the above can be combined in one character set declaration, for example:
512 <code class="literal">[[:digit:]a-c[.NUL.]]</code>.
515 <a name="boost_regex.syntax.perl_syntax.h20"></a>
516 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.escapes"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.escapes">Escapes</a>
519 Any special character preceded by an escape shall match itself.
522 The following escape sequences are all synonyms for single characters:
524 <div class="informaltable"><table class="table">
545 <code class="literal">\a</code>
550 <code class="literal">\a</code>
557 <code class="literal">\e</code>
562 <code class="literal">0x1B</code>
569 <code class="literal">\f</code>
574 <code class="literal">\f</code>
581 <code class="literal">\n</code>
586 <code class="literal">\n</code>
593 <code class="literal">\r</code>
598 <code class="literal">\r</code>
605 <code class="literal">\t</code>
610 <code class="literal">\t</code>
617 <code class="literal">\v</code>
622 <code class="literal">\v</code>
629 <code class="literal">\b</code>
634 <code class="literal">\b</code> (but only inside a character class declaration).
641 <code class="literal">\cX</code>
646 An ASCII escape sequence - the character whose code point is X
654 <code class="literal">\xdd</code>
659 A hexadecimal escape sequence - matches the single character whose
667 <code class="literal">\x{dddd}</code>
672 A hexadecimal escape sequence - matches the single character whose
673 code point is 0xdddd.
680 <code class="literal">\0ddd</code>
685 An octal escape sequence - matches the single character whose code
693 <code class="literal">\N{name}</code>
698 Matches the single character which has the <a class="link" href="collating_names.html" title="Collating Names">symbolic
699 name</a> <span class="emphasis"><em>name</em></span>. For example <code class="literal">\N{newline}</code>
700 matches the single character \n.
707 <a name="boost_regex.syntax.perl_syntax.h21"></a>
708 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.single_character_character_class"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.single_character_character_class">"Single
709 character" character classes:</a>
712 Any escaped character <span class="emphasis"><em>x</em></span>, if <span class="emphasis"><em>x</em></span> is
713 the name of a character class shall match any character that is a member
714 of that class, and any escaped character <span class="emphasis"><em>X</em></span>, if <span class="emphasis"><em>x</em></span>
715 is the name of a character class, shall match any character not in that class.
718 The following are supported by default:
720 <div class="informaltable"><table class="table">
741 <code class="computeroutput"><span class="special">\</span><span class="identifier">d</span></code>
746 <code class="computeroutput"><span class="special">[[:</span><span class="identifier">digit</span><span class="special">:]]</span></code>
753 <code class="computeroutput"><span class="special">\</span><span class="identifier">l</span></code>
758 <code class="computeroutput"><span class="special">[[:</span><span class="identifier">lower</span><span class="special">:]]</span></code>
765 <code class="computeroutput"><span class="special">\</span><span class="identifier">s</span></code>
770 <code class="computeroutput"><span class="special">[[:</span><span class="identifier">space</span><span class="special">:]]</span></code>
777 <code class="computeroutput"><span class="special">\</span><span class="identifier">u</span></code>
782 <code class="computeroutput"><span class="special">[[:</span><span class="identifier">upper</span><span class="special">:]]</span></code>
789 <code class="computeroutput"><span class="special">\</span><span class="identifier">w</span></code>
794 <code class="computeroutput"><span class="special">[[:</span><span class="identifier">word</span><span class="special">:]]</span></code>
801 <code class="computeroutput"><span class="special">\</span><span class="identifier">h</span></code>
806 Horizontal whitespace
813 <code class="computeroutput"><span class="special">\</span><span class="identifier">v</span></code>
825 <code class="computeroutput"><span class="special">\</span><span class="identifier">D</span></code>
830 <code class="computeroutput"><span class="special">[^[:</span><span class="identifier">digit</span><span class="special">:]]</span></code>
837 <code class="computeroutput"><span class="special">\</span><span class="identifier">L</span></code>
842 <code class="computeroutput"><span class="special">[^[:</span><span class="identifier">lower</span><span class="special">:]]</span></code>
849 <code class="computeroutput"><span class="special">\</span><span class="identifier">S</span></code>
854 <code class="computeroutput"><span class="special">[^[:</span><span class="identifier">space</span><span class="special">:]]</span></code>
861 <code class="computeroutput"><span class="special">\</span><span class="identifier">U</span></code>
866 <code class="computeroutput"><span class="special">[^[:</span><span class="identifier">upper</span><span class="special">:]]</span></code>
873 <code class="computeroutput"><span class="special">\</span><span class="identifier">W</span></code>
878 <code class="computeroutput"><span class="special">[^[:</span><span class="identifier">word</span><span class="special">:]]</span></code>
885 <code class="computeroutput"><span class="special">\</span><span class="identifier">H</span></code>
890 Not Horizontal whitespace
897 <code class="computeroutput"><span class="special">\</span><span class="identifier">V</span></code>
902 Not Vertical whitespace
909 <a name="boost_regex.syntax.perl_syntax.h22"></a>
910 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.character_properties"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.character_properties">Character
914 The character property names in the following table are all equivalent to
915 the <a class="link" href="character_classes.html" title="Character Class Names">names used in character
918 <div class="informaltable"><table class="table">
937 Equivalent character set form
945 <code class="computeroutput"><span class="special">\</span><span class="identifier">pX</span></code>
950 Matches any character that has the property X.
955 <code class="computeroutput"><span class="special">[[:</span><span class="identifier">X</span><span class="special">:]]</span></code>
962 <code class="computeroutput"><span class="special">\</span><span class="identifier">p</span><span class="special">{</span><span class="identifier">Name</span><span class="special">}</span></code>
967 Matches any character that has the property Name.
972 <code class="computeroutput"><span class="special">[[:</span><span class="identifier">Name</span><span class="special">:]]</span></code>
979 <code class="computeroutput"><span class="special">\</span><span class="identifier">PX</span></code>
984 Matches any character that does not have the property X.
989 <code class="computeroutput"><span class="special">[^[:</span><span class="identifier">X</span><span class="special">:]]</span></code>
996 <code class="computeroutput"><span class="special">\</span><span class="identifier">P</span><span class="special">{</span><span class="identifier">Name</span><span class="special">}</span></code>
1001 Matches any character that does not have the property Name.
1006 <code class="computeroutput"><span class="special">[^[:</span><span class="identifier">Name</span><span class="special">:]]</span></code>
1013 For example <code class="literal">\pd</code> matches any "digit" character,
1014 as does <code class="literal">\p{digit}</code>.
1017 <a name="boost_regex.syntax.perl_syntax.h23"></a>
1018 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.word_boundaries"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.word_boundaries">Word
1022 The following escape sequences match the boundaries of words:
1025 <code class="literal"><</code> Matches the start of a word.
1028 <code class="literal">></code> Matches the end of a word.
1031 <code class="literal">\b</code> Matches a word boundary (the start or end of a word).
1034 <code class="literal">\B</code> Matches only when not at a word boundary.
1037 <a name="boost_regex.syntax.perl_syntax.h24"></a>
1038 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.buffer_boundaries"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.buffer_boundaries">Buffer
1042 The following match only at buffer boundaries: a "buffer" in this
1043 context is the whole of the input text that is being matched against (note
1044 that ^ and $ may match embedded newlines within the text).
1047 \` Matches at the start of a buffer only.
1050 \' Matches at the end of a buffer only.
1053 \A Matches at the start of a buffer only (the same as <code class="literal">\`</code>).
1056 \z Matches at the end of a buffer only (the same as <code class="literal">\'</code>).
1059 \Z Matches a zero-width assertion consisting of an optional sequence of newlines
1060 at the end of a buffer: equivalent to the regular expression <code class="literal">(?=\v*\z)</code>.
1061 Note that this is subtly different from Perl which behaves as if matching
1062 <code class="literal">(?=\n?\z)</code>.
1065 <a name="boost_regex.syntax.perl_syntax.h25"></a>
1066 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.continuation_escape"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.continuation_escape">Continuation
1070 The sequence <code class="literal">\G</code> matches only at the end of the last match
1071 found, or at the start of the text being matched if no previous match was
1072 found. This escape useful if you're iterating over the matches contained
1073 within a text, and you want each subsequence match to start where the last
1077 <a name="boost_regex.syntax.perl_syntax.h26"></a>
1078 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.quoting_escape"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.quoting_escape">Quoting
1082 The escape sequence <code class="literal">\Q</code> begins a "quoted sequence":
1083 all the subsequent characters are treated as literals, until either the end
1084 of the regular expression or \E is found. For example the expression: <code class="literal">\Q*+\Ea+</code>
1085 would match either of:
1087 <pre class="programlisting"><span class="special">\*+</span><span class="identifier">a</span>
1088 <span class="special">\*+</span><span class="identifier">aaa</span>
1091 <a name="boost_regex.syntax.perl_syntax.h27"></a>
1092 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.unicode_escapes"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.unicode_escapes">Unicode
1096 <code class="literal">\C</code> Matches a single code point: in Boost regex this has
1097 exactly the same effect as a "." operator. <code class="literal">\X</code>
1098 Matches a combining character sequence: that is any non-combining character
1099 followed by a sequence of zero or more combining characters.
1102 <a name="boost_regex.syntax.perl_syntax.h28"></a>
1103 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.matching_line_endings"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.matching_line_endings">Matching Line
1107 The escape sequence <code class="literal">\R</code> matches any line ending character
1108 sequence, specifically it is identical to the expression <code class="literal">(?>\x0D\x0A?|[\x0A-\x0C\x85\x{2028}\x{2029}])</code>.
1111 <a name="boost_regex.syntax.perl_syntax.h29"></a>
1112 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.keeping_back_some_text"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.keeping_back_some_text">Keeping back
1116 <code class="literal">\K</code> Resets the start location of $0 to the current text
1117 position: in other words everything to the left of \K is "kept back"
1118 and does not form part of the regular expression match. $` is updated accordingly.
1121 For example <code class="literal">foo\Kbar</code> matched against the text "foobar"
1122 would return the match "bar" for $0 and "foo" for $`.
1123 This can be used to simulate variable width lookbehind assertions.
1126 <a name="boost_regex.syntax.perl_syntax.h30"></a>
1127 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.any_other_escape"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.any_other_escape">Any
1131 Any other escape sequence matches the character that is escaped, for example
1132 \@ matches a literal '@'.
1135 <a name="boost_regex.syntax.perl_syntax.h31"></a>
1136 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.perl_extended_patterns"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.perl_extended_patterns">Perl Extended
1140 Perl-specific extensions to the regular expression syntax all start with
1141 <code class="literal">(?</code>.
1144 <a name="boost_regex.syntax.perl_syntax.h32"></a>
1145 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.named_subexpressions"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.named_subexpressions">Named
1149 You can create a named subexpression using:
1151 <pre class="programlisting"><span class="special">(?<</span><span class="identifier">NAME</span><span class="special">></span><span class="identifier">expression</span><span class="special">)</span>
1154 Which can be then be referred to by the name <span class="emphasis"><em>NAME</em></span>. Alternatively
1155 you can delimit the name using 'NAME' as in:
1157 <pre class="programlisting"><span class="special">(?</span><span class="char">'NAME'</span><span class="identifier">expression</span><span class="special">)</span>
1160 These named subexpressions can be referred to in a backreference using either
1161 <code class="literal">\g{NAME}</code> or <code class="literal">\k<NAME></code> and can
1162 also be referred to by name in a <a class="link" href="../format/perl_format.html" title="Perl Format String Syntax">Perl</a>
1163 format string for search and replace operations, or in the <a class="link" href="../ref/match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> member functions.
1166 <a name="boost_regex.syntax.perl_syntax.h33"></a>
1167 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.comments"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.comments">Comments</a>
1170 <code class="literal">(?# ... )</code> is treated as a comment, it's contents are ignored.
1173 <a name="boost_regex.syntax.perl_syntax.h34"></a>
1174 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.modifiers"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.modifiers">Modifiers</a>
1177 <code class="literal">(?imsx-imsx ... )</code> alters which of the perl modifiers are
1178 in effect within the pattern, changes take effect from the point that the
1179 block is first seen and extend to any enclosing <code class="literal">)</code>. Letters
1180 before a '-' turn that perl modifier on, letters afterward, turn it off.
1183 <code class="literal">(?imsx-imsx:pattern)</code> applies the specified modifiers to
1187 <a name="boost_regex.syntax.perl_syntax.h35"></a>
1188 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.non_marking_groups"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.non_marking_groups">Non-marking
1192 <code class="literal">(?:pattern)</code> lexically groups pattern, without generating
1193 an additional sub-expression.
1196 <a name="boost_regex.syntax.perl_syntax.h36"></a>
1197 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.branch_reset"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.branch_reset">Branch
1201 <code class="literal">(?|pattern)</code> resets the subexpression count at the start
1202 of each "|" alternative within <span class="emphasis"><em>pattern</em></span>.
1205 The sub-expression count following this construct is that of whichever branch
1206 had the largest number of sub-expressions. This construct is useful when
1207 you want to capture one of a number of alternative matches in a single sub-expression
1211 In the following example the index of each sub-expression is shown below
1214 <pre class="programlisting"># before ---------------branch-reset----------- after
1215 / ( a ) (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
1219 <a name="boost_regex.syntax.perl_syntax.h37"></a>
1220 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.lookahead"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.lookahead">Lookahead</a>
1223 <code class="literal">(?=pattern)</code> consumes zero characters, only if pattern
1227 <code class="literal">(?!pattern)</code> consumes zero characters, only if pattern
1231 Lookahead is typically used to create the logical AND of two regular expressions,
1232 for example if a password must contain a lower case letter, an upper case
1233 letter, a punctuation symbol, and be at least 6 characters long, then the
1236 <pre class="programlisting"><span class="special">(?=.*[[:</span><span class="identifier">lower</span><span class="special">:]])(?=.*[[:</span><span class="identifier">upper</span><span class="special">:]])(?=.*[[:</span><span class="identifier">punct</span><span class="special">:]]).{</span><span class="number">6</span><span class="special">,}</span>
1239 could be used to validate the password.
1242 <a name="boost_regex.syntax.perl_syntax.h38"></a>
1243 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.lookbehind"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.lookbehind">Lookbehind</a>
1246 <code class="literal">(?<=pattern)</code> consumes zero characters, only if pattern
1247 could be matched against the characters preceding the current position (pattern
1248 must be of fixed length).
1251 <code class="literal">(?<!pattern)</code> consumes zero characters, only if pattern
1252 could not be matched against the characters preceding the current position
1253 (pattern must be of fixed length).
1256 <a name="boost_regex.syntax.perl_syntax.h39"></a>
1257 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.independent_sub_expressions"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.independent_sub_expressions">Independent
1261 <code class="literal">(?>pattern)</code> <span class="emphasis"><em>pattern</em></span> is matched
1262 independently of the surrounding patterns, the expression will never backtrack
1263 into <span class="emphasis"><em>pattern</em></span>. Independent sub-expressions are typically
1264 used to improve performance; only the best possible match for pattern will
1265 be considered, if this doesn't allow the expression as a whole to match then
1266 no match is found at all.
1269 <a name="boost_regex.syntax.perl_syntax.h40"></a>
1270 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.recursive_expressions"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.recursive_expressions">Recursive
1274 <code class="literal">(?<span class="emphasis"><em>N</em></span>) (?-<span class="emphasis"><em>N</em></span>) (?+<span class="emphasis"><em>N</em></span>)
1275 (?R) (?0) (?&NAME)</code>
1278 <code class="literal">(?R)</code> and <code class="literal">(?0)</code> recurse to the start
1279 of the entire pattern.
1282 <code class="literal">(?<span class="emphasis"><em>N</em></span>)</code> executes sub-expression <span class="emphasis"><em>N</em></span>
1283 recursively, for example <code class="literal">(?2)</code> will recurse to sub-expression
1287 <code class="literal">(?-<span class="emphasis"><em>N</em></span>)</code> and <code class="literal">(?+<span class="emphasis"><em>N</em></span>)</code>
1288 are relative recursions, so for example <code class="literal">(?-1)</code> recurses
1289 to the last sub-expression to be declared, and <code class="literal">(?+1)</code> recurses
1290 to the next sub-expression to be declared.
1293 <code class="literal">(?&NAME)</code> recurses to named sub-expression <span class="emphasis"><em>NAME</em></span>.
1296 <a name="boost_regex.syntax.perl_syntax.h41"></a>
1297 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.conditional_expressions"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.conditional_expressions">Conditional
1301 <code class="literal">(?(condition)yes-pattern|no-pattern)</code> attempts to match
1302 <span class="emphasis"><em>yes-pattern</em></span> if the <span class="emphasis"><em>condition</em></span> is
1303 true, otherwise attempts to match <span class="emphasis"><em>no-pattern</em></span>.
1306 <code class="literal">(?(condition)yes-pattern)</code> attempts to match <span class="emphasis"><em>yes-pattern</em></span>
1307 if the <span class="emphasis"><em>condition</em></span> is true, otherwise matches the NULL
1311 <span class="emphasis"><em>condition</em></span> may be either: a forward lookahead assert,
1312 the index of a marked sub-expression (the condition becomes true if the sub-expression
1313 has been matched), or an index of a recursion (the condition become true
1314 if we are executing directly inside the specified recursion).
1317 Here is a summary of the possible predicates:
1319 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1320 <li class="listitem">
1321 <code class="literal">(?(?=assert)yes-pattern|no-pattern)</code> Executes <span class="emphasis"><em>yes-pattern</em></span>
1322 if the forward look-ahead assert matches, otherwise executes <span class="emphasis"><em>no-pattern</em></span>.
1324 <li class="listitem">
1325 <code class="literal">(?(?!assert)yes-pattern|no-pattern)</code> Executes <span class="emphasis"><em>yes-pattern</em></span>
1326 if the forward look-ahead assert does not match, otherwise executes
1327 <span class="emphasis"><em>no-pattern</em></span>.
1329 <li class="listitem">
1330 <code class="literal">(?(<span class="emphasis"><em>N</em></span>)yes-pattern|no-pattern)</code>
1331 Executes <span class="emphasis"><em>yes-pattern</em></span> if subexpression <span class="emphasis"><em>N</em></span>
1332 has been matched, otherwise executes <span class="emphasis"><em>no-pattern</em></span>.
1334 <li class="listitem">
1335 <code class="literal">(?(<<span class="emphasis"><em>name</em></span>>)yes-pattern|no-pattern)</code>
1336 Executes <span class="emphasis"><em>yes-pattern</em></span> if named subexpression <span class="emphasis"><em>name</em></span>
1337 has been matched, otherwise executes <span class="emphasis"><em>no-pattern</em></span>.
1339 <li class="listitem">
1340 <code class="literal">(?('<span class="emphasis"><em>name</em></span>')yes-pattern|no-pattern)</code>
1341 Executes <span class="emphasis"><em>yes-pattern</em></span> if named subexpression <span class="emphasis"><em>name</em></span>
1342 has been matched, otherwise executes <span class="emphasis"><em>no-pattern</em></span>.
1344 <li class="listitem">
1345 <code class="literal">(?(R)yes-pattern|no-pattern)</code> Executes <span class="emphasis"><em>yes-pattern</em></span>
1346 if we are executing inside a recursion, otherwise executes <span class="emphasis"><em>no-pattern</em></span>.
1348 <li class="listitem">
1349 <code class="literal">(?(R<span class="emphasis"><em>N</em></span>)yes-pattern|no-pattern)</code>
1350 Executes <span class="emphasis"><em>yes-pattern</em></span> if we are executing inside
1351 a recursion to sub-expression <span class="emphasis"><em>N</em></span>, otherwise executes
1352 <span class="emphasis"><em>no-pattern</em></span>.
1354 <li class="listitem">
1355 <code class="literal">(?(R&<span class="emphasis"><em>name</em></span>)yes-pattern|no-pattern)</code>
1356 Executes <span class="emphasis"><em>yes-pattern</em></span> if we are executing inside
1357 a recursion to named sub-expression <span class="emphasis"><em>name</em></span>, otherwise
1358 executes <span class="emphasis"><em>no-pattern</em></span>.
1360 <li class="listitem">
1361 <code class="literal">(?(DEFINE)never-exectuted-pattern)</code> Defines a block
1362 of code that is never executed and matches no characters: this is usually
1363 used to define one or more named sub-expressions which are referred to
1364 from elsewhere in the pattern.
1368 <a name="boost_regex.syntax.perl_syntax.h42"></a>
1369 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.backtracking_control_verbs"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.backtracking_control_verbs">Backtracking
1373 This library has partial support for Perl's backtracking control verbs, in
1374 particular (*MARK) is not supported. There may also be detail differences
1375 in behaviour between this library and Perl, not least because Perl's behaviour
1376 is rather under-documented and often somewhat random in how it behaves in
1377 practice. The verbs supported are:
1379 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1380 <li class="listitem">
1381 <code class="literal">(*PRUNE)</code> Has no effect unless backtracked onto, in
1382 which case all the backtracking information prior to this point is discarded.
1384 <li class="listitem">
1385 <code class="literal">(*SKIP)</code> Behaves the same as <code class="literal">(*PRUNE)</code>
1386 except that it is assumed that no match can possibly occur prior to the
1387 current point in the string being searched. This can be used to optimize
1388 searches by skipping over chunks of text that have already been determined
1389 can not form a match.
1391 <li class="listitem">
1392 <code class="literal">(*THEN)</code> Has no effect unless backtracked onto, in
1393 which case all subsequent alternatives in a group of alternations are
1396 <li class="listitem">
1397 <code class="literal">(*COMMIT)</code> Has no effect unless backtracked onto, in
1398 which case all subsequent matching/searching attempts are abandoned.
1400 <li class="listitem">
1401 <code class="literal">(*FAIL)</code> Causes the match to fail unconditionally at
1402 this point, can be used to force the engine to backtrack.
1404 <li class="listitem">
1405 <code class="literal">(*ACCEPT)</code> Causes the pattern to be considered matched
1406 at the current point. Any half-open sub-expressions are closed at the
1411 <a name="boost_regex.syntax.perl_syntax.h43"></a>
1412 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.operator_precedence"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.operator_precedence">Operator
1416 The order of precedence for of operators is as follows:
1418 <div class="orderedlist"><ol class="orderedlist" type="1">
1419 <li class="listitem">
1420 Collation-related bracket symbols <code class="computeroutput"><span class="special">[==]</span>
1421 <span class="special">[::]</span> <span class="special">[..]</span></code>
1423 <li class="listitem">
1424 Escaped characters <code class="literal">\</code>
1426 <li class="listitem">
1427 Character set (bracket expression) <code class="computeroutput"><span class="special">[]</span></code>
1429 <li class="listitem">
1430 Grouping <code class="literal">()</code>
1432 <li class="listitem">
1433 Single-character-ERE duplication <code class="literal">* + ? {m,n}</code>
1435 <li class="listitem">
1438 <li class="listitem">
1441 <li class="listitem">
1446 <a name="boost_regex.syntax.perl_syntax.h44"></a>
1447 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.what_gets_matched"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.what_gets_matched">What
1451 If you view the regular expression as a directed (possibly cyclic) graph,
1452 then the best match found is the first match found by a depth-first-search
1453 performed on that graph, while matching the input text.
1459 The best match found is the <a class="link" href="leftmost_longest_rule.html" title="The Leftmost Longest Rule">leftmost
1460 match</a>, with individual elements matched as follows;
1462 <div class="informaltable"><table class="table">
1483 <code class="literal">AtomA AtomB</code>
1488 Locates the best match for <span class="emphasis"><em>AtomA</em></span> that has
1489 a following match for <span class="emphasis"><em>AtomB</em></span>.
1496 <code class="literal">Expression1 | Expression2</code>
1501 If <span class="emphasis"><em>Expresion1</em></span> can be matched then returns
1502 that match, otherwise attempts to match <span class="emphasis"><em>Expression2</em></span>.
1509 <code class="literal">S{N}</code>
1514 Matches <span class="emphasis"><em>S</em></span> repeated exactly N times.
1521 <code class="literal">S{N,M}</code>
1526 Matches S repeated between N and M times, and as many times as
1534 <code class="literal">S{N,M}?</code>
1539 Matches S repeated between N and M times, and as few times as possible.
1546 <code class="literal">S?, S*, S+</code>
1551 The same as <code class="literal">S{0,1}</code>, <code class="literal">S{0,UINT_MAX}</code>,
1552 <code class="literal">S{1,UINT_MAX}</code> respectively.
1559 <code class="literal">S??, S*?, S+?</code>
1564 The same as <code class="literal">S{0,1}?</code>, <code class="literal">S{0,UINT_MAX}?</code>,
1565 <code class="literal">S{1,UINT_MAX}?</code> respectively.
1572 <code class="literal">(?>S)</code>
1577 Matches the best match for <span class="emphasis"><em>S</em></span>, and only that.
1584 <code class="literal">(?=S), (?<=S)</code>
1589 Matches only the best match for <span class="emphasis"><em>S</em></span> (this is
1590 only visible if there are capturing parenthesis within <span class="emphasis"><em>S</em></span>).
1597 <code class="literal">(?!S), (?<!S)</code>
1602 Considers only whether a match for S exists or not.
1609 <code class="literal">(?(condition)yes-pattern | no-pattern)</code>
1614 If condition is true, then only yes-pattern is considered, otherwise
1615 only no-pattern is considered.
1622 <a name="boost_regex.syntax.perl_syntax.h45"></a>
1623 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.variations"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.variations">Variations</a>
1626 The <a class="link" href="../ref/syntax_option_type/syntax_option_type_perl.html" title="Options for Perl Regular Expressions">options
1627 <code class="literal">normal</code>, <code class="literal">ECMAScript</code>, <code class="literal">JavaScript</code>
1628 and <code class="literal">JScript</code></a> are all synonyms for <code class="literal">perl</code>.
1631 <a name="boost_regex.syntax.perl_syntax.h46"></a>
1632 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.options"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.options">Options</a>
1635 There are a <a class="link" href="../ref/syntax_option_type/syntax_option_type_perl.html" title="Options for Perl Regular Expressions">variety
1636 of flags</a> that may be combined with the <code class="literal">perl</code> option
1637 when constructing the regular expression, in particular note that the <code class="literal">newline_alt</code>
1638 option alters the syntax, while the <code class="literal">collate</code>, <code class="literal">nosubs</code>
1639 and <code class="literal">icase</code> options modify how the case and locale sensitivity
1643 <a name="boost_regex.syntax.perl_syntax.h47"></a>
1644 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.pattern_modifiers"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.pattern_modifiers">Pattern
1648 The perl <code class="literal">smix</code> modifiers can either be applied using a
1649 <code class="literal">(?smix-smix)</code> prefix to the regular expression, or with
1650 one of the <a class="link" href="../ref/syntax_option_type/syntax_option_type_perl.html" title="Options for Perl Regular Expressions">regex-compile
1651 time flags <code class="literal">no_mod_m</code>, <code class="literal">mod_x</code>, <code class="literal">mod_s</code>,
1652 and <code class="literal">no_mod_s</code></a>.
1655 <a name="boost_regex.syntax.perl_syntax.h48"></a>
1656 <span class="phrase"><a name="boost_regex.syntax.perl_syntax.references"></a></span><a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.references">References</a>
1659 <a href="http://perldoc.perl.org/perlre.html" target="_top">Perl 5.8</a>.
1662 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
1663 <td align="left"></td>
1664 <td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p>
1665 Distributed under the Boost Software License, Version 1.0. (See accompanying
1666 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
1671 <div class="spirit-nav">
1672 <a accesskey="p" href="../syntax.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../syntax.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="basic_extended.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>