Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / regex / doc / html / boost_regex / syntax / basic_syntax.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>POSIX Basic 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.78.1">
7 <link rel="home" href="../../index.html" title="Boost.Regex 5.0.0">
8 <link rel="up" href="../syntax.html" title="Regular Expression Syntax">
9 <link rel="prev" href="basic_extended.html" title="POSIX Extended Regular Expression Syntax">
10 <link rel="next" href="character_classes.html" title="Character Class Names">
11 </head>
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>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="basic_extended.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="character_classes.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="boost_regex.syntax.basic_syntax"></a><a class="link" href="basic_syntax.html" title="POSIX Basic Regular Expression Syntax">POSIX Basic Regular
28       Expression Syntax</a>
29 </h3></div></div></div>
30 <h4>
31 <a name="boost_regex.syntax.basic_syntax.h0"></a>
32         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.synopsis"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.synopsis">Synopsis</a>
33       </h4>
34 <p>
35         The POSIX-Basic regular expression syntax is used by the Unix utility <code class="computeroutput"><span class="identifier">sed</span></code>, and variations are used by <code class="computeroutput"><span class="identifier">grep</span></code> and <code class="computeroutput"><span class="identifier">emacs</span></code>.
36         You can construct POSIX basic regular expressions in Boost.Regex by passing
37         the flag <code class="computeroutput"><span class="identifier">basic</span></code> to the regex
38         constructor (see <a class="link" href="../ref/syntax_option_type.html" title="syntax_option_type"><code class="computeroutput"><span class="identifier">syntax_option_type</span></code></a>), for example:
39       </p>
40 <pre class="programlisting"><span class="comment">// e1 is a case sensitive POSIX-Basic expression:</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> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span><span class="special">::</span><span class="identifier">basic</span><span class="special">);</span>
42 <span class="comment">// e2 a case insensitive POSIX-Basic 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">basic</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>
44 </pre>
45 <a name="boost_regex.posix_basic"></a><h4>
46 <a name="boost_regex.syntax.basic_syntax.h1"></a>
47         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.posix_basic_syntax"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.posix_basic_syntax">POSIX
48         Basic Syntax</a>
49       </h4>
50 <p>
51         In POSIX-Basic regular expressions, all characters are match themselves except
52         for the following special characters:
53       </p>
54 <pre class="programlisting">.[\*^$</pre>
55 <h5>
56 <a name="boost_regex.syntax.basic_syntax.h2"></a>
57         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.wildcard_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.wildcard_">Wildcard:</a>
58       </h5>
59 <p>
60         The single character '.' when used outside of a character set will match
61         any single character except:
62       </p>
63 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
64 <li class="listitem">
65             The NULL character when the flag <code class="computeroutput"><span class="identifier">match_no_dot_null</span></code>
66             is passed to the matching algorithms.
67           </li>
68 <li class="listitem">
69             The newline character when the flag <code class="computeroutput"><span class="identifier">match_not_dot_newline</span></code>
70             is passed to the matching algorithms.
71           </li>
72 </ul></div>
73 <h5>
74 <a name="boost_regex.syntax.basic_syntax.h3"></a>
75         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.anchors_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.anchors_">Anchors:</a>
76       </h5>
77 <p>
78         A '^' character shall match the start of a line when used as the first character
79         of an expression, or the first character of a sub-expression.
80       </p>
81 <p>
82         A '$' character shall match the end of a line when used as the last character
83         of an expression, or the last character of a sub-expression.
84       </p>
85 <h5>
86 <a name="boost_regex.syntax.basic_syntax.h4"></a>
87         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.marked_sub_expressions_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.marked_sub_expressions_">Marked
88         sub-expressions:</a>
89       </h5>
90 <p>
91         A section beginning <code class="computeroutput"><span class="special">\(</span></code> and ending
92         <code class="computeroutput"><span class="special">\)</span></code> acts as a marked sub-expression.
93         Whatever matched the sub-expression is split out in a separate field by the
94         matching algorithms. Marked sub-expressions can also repeated, or referred-to
95         by a back-reference.
96       </p>
97 <h5>
98 <a name="boost_regex.syntax.basic_syntax.h5"></a>
99         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.repeats_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.repeats_">Repeats:</a>
100       </h5>
101 <p>
102         Any atom (a single character, a marked sub-expression, or a character class)
103         can be repeated with the * operator.
104       </p>
105 <p>
106         For example <code class="computeroutput"><span class="identifier">a</span><span class="special">*</span></code>
107         will match any number of letter a's repeated zero or more times (an atom
108         repeated zero times matches an empty string), so the expression <code class="computeroutput"><span class="identifier">a</span><span class="special">*</span><span class="identifier">b</span></code>
109         will match any of the following:
110       </p>
111 <pre class="programlisting">b
112 ab
113 aaaaaaaab
114 </pre>
115 <p>
116         An atom can also be repeated with a bounded repeat:
117       </p>
118 <p>
119         <code class="computeroutput"><span class="identifier">a</span><span class="special">\{</span><span class="identifier">n</span><span class="special">\}</span></code> Matches
120         'a' repeated exactly n times.
121       </p>
122 <p>
123         <code class="computeroutput"><span class="identifier">a</span><span class="special">\{</span><span class="identifier">n</span><span class="special">,\}</span></code> Matches
124         'a' repeated n or more times.
125       </p>
126 <p>
127         <code class="computeroutput"><span class="identifier">a</span><span class="special">\{</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">m</span><span class="special">\}</span></code> Matches 'a' repeated between n and m times
128         inclusive.
129       </p>
130 <p>
131         For example:
132       </p>
133 <pre class="programlisting">^a{2,3}$</pre>
134 <p>
135         Will match either of:
136       </p>
137 <pre class="programlisting">aa
138 aaa
139 </pre>
140 <p>
141         But neither of:
142       </p>
143 <pre class="programlisting">a
144 aaaa
145 </pre>
146 <p>
147         It is an error to use a repeat operator, if the preceding construct can not
148         be repeated, for example:
149       </p>
150 <pre class="programlisting">a(*)</pre>
151 <p>
152         Will raise an error, as there is nothing for the * operator to be applied
153         to.
154       </p>
155 <h5>
156 <a name="boost_regex.syntax.basic_syntax.h6"></a>
157         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.back_references_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.back_references_">Back
158         references:</a>
159       </h5>
160 <p>
161         An escape character followed by a digit <span class="emphasis"><em>n</em></span>, where <span class="emphasis"><em>n</em></span>
162         is in the range 1-9, matches the same string that was matched by sub-expression
163         <span class="emphasis"><em>n</em></span>. For example the expression:
164       </p>
165 <pre class="programlisting">^\(a*\).*\1$</pre>
166 <p>
167         Will match the string:
168       </p>
169 <pre class="programlisting">aaabbaaa</pre>
170 <p>
171         But not the string:
172       </p>
173 <pre class="programlisting">aaabba</pre>
174 <h5>
175 <a name="boost_regex.syntax.basic_syntax.h7"></a>
176         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.character_sets_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_sets_">Character
177         sets:</a>
178       </h5>
179 <p>
180         A character set is a bracket-expression starting with [ and ending with ],
181         it defines a set of characters, and matches any single character that is
182         a member of that set.
183       </p>
184 <p>
185         A bracket expression may contain any combination of the following:
186       </p>
187 <h6>
188 <a name="boost_regex.syntax.basic_syntax.h8"></a>
189         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.single_characters_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.single_characters_">Single
190         characters:</a>
191       </h6>
192 <p>
193         For example <code class="computeroutput"><span class="special">[</span><span class="identifier">abc</span><span class="special">]</span></code>, will match any of the characters 'a', 'b',
194         or 'c'.
195       </p>
196 <h6>
197 <a name="boost_regex.syntax.basic_syntax.h9"></a>
198         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.character_ranges_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_ranges_">Character
199         ranges:</a>
200       </h6>
201 <p>
202         For example <code class="computeroutput"><span class="special">[</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">c</span><span class="special">]</span></code>
203         will match any single character in the range 'a' to 'c'. By default, for
204         POSIX-Basic regular expressions, a character <span class="emphasis"><em>x</em></span> is within
205         the range <span class="emphasis"><em>y</em></span> to <span class="emphasis"><em>z</em></span>, if it collates
206         within that range; this results in locale specific behavior. This behavior
207         can be turned off by unsetting the <code class="computeroutput"><span class="identifier">collate</span></code>
208         option flag when constructing the regular expression - in which case whether
209         a character appears within a range is determined by comparing the code points
210         of the characters only.
211       </p>
212 <h6>
213 <a name="boost_regex.syntax.basic_syntax.h10"></a>
214         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.negation_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.negation_">Negation:</a>
215       </h6>
216 <p>
217         If the bracket-expression begins with the ^ character, then it matches the
218         complement of the characters it contains, for example <code class="computeroutput"><span class="special">[^</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">c</span><span class="special">]</span></code> matches any character that is not in the
219         range a-c.
220       </p>
221 <h6>
222 <a name="boost_regex.syntax.basic_syntax.h11"></a>
223         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.character_classes_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.character_classes_">Character
224         classes:</a>
225       </h6>
226 <p>
227         An expression of the form <code class="computeroutput"><span class="special">[[:</span><span class="identifier">name</span><span class="special">:]]</span></code>
228         matches the named character class "name", for example <code class="computeroutput"><span class="special">[[:</span><span class="identifier">lower</span><span class="special">:]]</span></code> matches any lower case character. See
229         <a class="link" href="character_classes.html" title="Character Class Names">character class names</a>.
230       </p>
231 <h6>
232 <a name="boost_regex.syntax.basic_syntax.h12"></a>
233         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.collating_elements_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.collating_elements_">Collating
234         Elements:</a>
235       </h6>
236 <p>
237         An expression of the form <code class="computeroutput"><span class="special">[[.</span><span class="identifier">col</span><span class="special">.]</span></code> matches
238         the collating element <span class="emphasis"><em>col</em></span>. A collating element is any
239         single character, or any sequence of characters that collates as a single
240         unit. Collating elements may also be used as the end point of a range, for
241         example: <code class="computeroutput"><span class="special">[[.</span><span class="identifier">ae</span><span class="special">.]-</span><span class="identifier">c</span><span class="special">]</span></code>
242         matches the character sequence "ae", plus any single character
243         in the rangle "ae"-c, assuming that "ae" is treated as
244         a single collating element in the current locale.
245       </p>
246 <p>
247         Collating elements may be used in place of escapes (which are not normally
248         allowed inside character sets), for example <code class="computeroutput"><span class="special">[[.^.]</span><span class="identifier">abc</span><span class="special">]</span></code> would
249         match either one of the characters 'abc^'.
250       </p>
251 <p>
252         As an extension, a collating element may also be specified via its symbolic
253         name, for example:
254       </p>
255 <pre class="programlisting">[[.NUL.]]</pre>
256 <p>
257         matches a 'NUL' character. See <a class="link" href="collating_names.html" title="Collating Names">collating
258         element names</a>.
259       </p>
260 <h6>
261 <a name="boost_regex.syntax.basic_syntax.h13"></a>
262         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.equivalence_classes_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.equivalence_classes_">Equivalence
263         classes:</a>
264       </h6>
265 <p>
266         An expression of the form <code class="computeroutput"><span class="special">[[=</span><span class="identifier">col</span><span class="special">=]]</span></code>,
267         matches any character or collating element whose primary sort key is the
268         same as that for collating element <span class="emphasis"><em>col</em></span>, as with collating
269         elements the name <span class="emphasis"><em>col</em></span> may be a <a class="link" href="collating_names.html" title="Collating Names">collating
270         symbolic name</a>. A primary sort key is one that ignores case, accentation,
271         or locale-specific tailorings; so for example <code class="computeroutput"><span class="special">[[=</span><span class="identifier">a</span><span class="special">=]]</span></code> matches
272         any of the characters: a, &#192;, &#193;, &#194;, &#195;, &#196;, &#197;, A, &#224;, &#225;, &#226;, &#227;, &#228; and &#229;. Unfortunately implementation
273         of this is reliant on the platform's collation and localisation support;
274         this feature can not be relied upon to work portably across all platforms,
275         or even all locales on one platform.
276       </p>
277 <h6>
278 <a name="boost_regex.syntax.basic_syntax.h14"></a>
279         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.combinations_"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.combinations_">Combinations:</a>
280       </h6>
281 <p>
282         All of the above can be combined in one character set declaration, for example:
283         <code class="computeroutput"><span class="special">[[:</span><span class="identifier">digit</span><span class="special">:]</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">c</span><span class="special">[.</span><span class="identifier">NUL</span><span class="special">.]].</span></code>
284       </p>
285 <h5>
286 <a name="boost_regex.syntax.basic_syntax.h15"></a>
287         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.escapes"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.escapes">Escapes</a>
288       </h5>
289 <p>
290         With the exception of the escape sequences \{, \}, \(, and \), which are
291         documented above, an escape followed by any character matches that character.
292         This can be used to make the special characters
293       </p>
294 <pre class="programlisting">.[\*^$</pre>
295 <p>
296         "ordinary". Note that the escape character loses its special meaning
297         inside a character set, so <code class="computeroutput"><span class="special">[\^]</span></code>
298         will match either a literal '\' or a '^'.
299       </p>
300 <h4>
301 <a name="boost_regex.syntax.basic_syntax.h16"></a>
302         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.what_gets_matched"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.what_gets_matched">What
303         Gets Matched</a>
304       </h4>
305 <p>
306         When there is more that one way to match a regular expression, the "best"
307         possible match is obtained using the <a class="link" href="leftmost_longest_rule.html" title="The Leftmost Longest Rule">leftmost-longest
308         rule</a>.
309       </p>
310 <h4>
311 <a name="boost_regex.syntax.basic_syntax.h17"></a>
312         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.variations"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.variations">Variations</a>
313       </h4>
314 <a name="boost_regex.grep_syntax"></a><h5>
315 <a name="boost_regex.syntax.basic_syntax.h18"></a>
316         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.grep"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.grep">Grep</a>
317       </h5>
318 <p>
319         When an expression is compiled with the flag <code class="computeroutput"><span class="identifier">grep</span></code>
320         set, then the expression is treated as a newline separated list of <a class="link" href="basic_syntax.html#boost_regex.posix_basic">POSIX-Basic expressions</a>, a match
321         is found if any of the expressions in the list match, for example:
322       </p>
323 <pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span> <span class="identifier">e</span><span class="special">(</span><span class="string">"abc\ndef"</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">grep</span><span class="special">);</span>
324 </pre>
325 <p>
326         will match either of the <a class="link" href="basic_syntax.html#boost_regex.posix_basic">POSIX-Basic
327         expressions</a> "abc" or "def".
328       </p>
329 <p>
330         As its name suggests, this behavior is consistent with the Unix utility grep.
331       </p>
332 <h5>
333 <a name="boost_regex.syntax.basic_syntax.h19"></a>
334         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.emacs"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.emacs">emacs</a>
335       </h5>
336 <p>
337         In addition to the <a class="link" href="basic_syntax.html#boost_regex.posix_basic">POSIX-Basic features</a>
338         the following characters are also special:
339       </p>
340 <div class="informaltable"><table class="table">
341 <colgroup>
342 <col>
343 <col>
344 </colgroup>
345 <thead><tr>
346 <th>
347                 <p>
348                   Character
349                 </p>
350               </th>
351 <th>
352                 <p>
353                   Description
354                 </p>
355               </th>
356 </tr></thead>
357 <tbody>
358 <tr>
359 <td>
360                 <p>
361                   +
362                 </p>
363               </td>
364 <td>
365                 <p>
366                   repeats the preceding atom one or more times.
367                 </p>
368               </td>
369 </tr>
370 <tr>
371 <td>
372                 <p>
373                   ?
374                 </p>
375               </td>
376 <td>
377                 <p>
378                   repeats the preceding atom zero or one times.
379                 </p>
380               </td>
381 </tr>
382 <tr>
383 <td>
384                 <p>
385                   *?
386                 </p>
387               </td>
388 <td>
389                 <p>
390                   A non-greedy version of *.
391                 </p>
392               </td>
393 </tr>
394 <tr>
395 <td>
396                 <p>
397                   +?
398                 </p>
399               </td>
400 <td>
401                 <p>
402                   A non-greedy version of +.
403                 </p>
404               </td>
405 </tr>
406 <tr>
407 <td>
408                 <p>
409                   ??
410                 </p>
411               </td>
412 <td>
413                 <p>
414                   A non-greedy version of ?.
415                 </p>
416               </td>
417 </tr>
418 </tbody>
419 </table></div>
420 <p>
421         And the following escape sequences are also recognised:
422       </p>
423 <div class="informaltable"><table class="table">
424 <colgroup>
425 <col>
426 <col>
427 </colgroup>
428 <thead><tr>
429 <th>
430                 <p>
431                   Escape
432                 </p>
433               </th>
434 <th>
435                 <p>
436                   Description
437                 </p>
438               </th>
439 </tr></thead>
440 <tbody>
441 <tr>
442 <td>
443                 <p>
444                   \|
445                 </p>
446               </td>
447 <td>
448                 <p>
449                   specifies an alternative.
450                 </p>
451               </td>
452 </tr>
453 <tr>
454 <td>
455                 <p>
456                   \(?: ... )
457                 </p>
458               </td>
459 <td>
460                 <p>
461                   is a non-marking grouping construct - allows you to lexically group
462                   something without spitting out an extra sub-expression.
463                 </p>
464               </td>
465 </tr>
466 <tr>
467 <td>
468                 <p>
469                   \w
470                 </p>
471               </td>
472 <td>
473                 <p>
474                   matches any word character.
475                 </p>
476               </td>
477 </tr>
478 <tr>
479 <td>
480                 <p>
481                   \W
482                 </p>
483               </td>
484 <td>
485                 <p>
486                   matches any non-word character.
487                 </p>
488               </td>
489 </tr>
490 <tr>
491 <td>
492                 <p>
493                   \sx
494                 </p>
495               </td>
496 <td>
497                 <p>
498                   matches any character in the syntax group x, the following emacs
499                   groupings are supported: 's', ' ', '_', 'w', '.', ')', '(', '"',
500                   '\'', '&gt;' and '&lt;'. Refer to the emacs docs for details.
501                 </p>
502               </td>
503 </tr>
504 <tr>
505 <td>
506                 <p>
507                   \Sx
508                 </p>
509               </td>
510 <td>
511                 <p>
512                   matches any character not in the syntax grouping x.
513                 </p>
514               </td>
515 </tr>
516 <tr>
517 <td>
518                 <p>
519                   \c and \C
520                 </p>
521               </td>
522 <td>
523                 <p>
524                   These are not supported.
525                 </p>
526               </td>
527 </tr>
528 <tr>
529 <td>
530                 <p>
531                   \`
532                 </p>
533               </td>
534 <td>
535                 <p>
536                   matches zero characters only at the start of a buffer (or string
537                   being matched).
538                 </p>
539               </td>
540 </tr>
541 <tr>
542 <td>
543                 <p>
544                   \'
545                 </p>
546               </td>
547 <td>
548                 <p>
549                   matches zero characters only at the end of a buffer (or string
550                   being matched).
551                 </p>
552               </td>
553 </tr>
554 <tr>
555 <td>
556                 <p>
557                   \b
558                 </p>
559               </td>
560 <td>
561                 <p>
562                   matches zero characters at a word boundary.
563                 </p>
564               </td>
565 </tr>
566 <tr>
567 <td>
568                 <p>
569                   \B
570                 </p>
571               </td>
572 <td>
573                 <p>
574                   matches zero characters, not at a word boundary.
575                 </p>
576               </td>
577 </tr>
578 <tr>
579 <td>
580                 <p>
581                   \&lt;
582                 </p>
583               </td>
584 <td>
585                 <p>
586                   matches zero characters only at the start of a word.
587                 </p>
588               </td>
589 </tr>
590 <tr>
591 <td>
592                 <p>
593                   \&gt;
594                 </p>
595               </td>
596 <td>
597                 <p>
598                   matches zero characters only at the end of a word.
599                 </p>
600               </td>
601 </tr>
602 </tbody>
603 </table></div>
604 <p>
605         Finally, you should note that emacs style regular expressions are matched
606         according to the <a class="link" href="perl_syntax.html#boost_regex.syntax.perl_syntax.what_gets_matched">Perl
607         "depth first search" rules</a>. Emacs expressions are matched
608         this way because they contain Perl-like extensions, that do not interact
609         well with the <a class="link" href="leftmost_longest_rule.html" title="The Leftmost Longest Rule">POSIX-style
610         leftmost-longest rule</a>.
611       </p>
612 <h4>
613 <a name="boost_regex.syntax.basic_syntax.h20"></a>
614         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.options"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.options">Options</a>
615       </h4>
616 <p>
617         There are a <a class="link" href="../ref/syntax_option_type/syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions">variety
618         of flags</a> that may be combined with the <code class="computeroutput"><span class="identifier">basic</span></code>
619         and <code class="computeroutput"><span class="identifier">grep</span></code> options when constructing
620         the regular expression, in particular note that the <a class="link" href="../ref/syntax_option_type/syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions"><code class="computeroutput"><span class="identifier">newline_alt</span></code>, <code class="computeroutput"><span class="identifier">no_char_classes</span></code>,
621         <code class="computeroutput"><span class="identifier">no</span><span class="special">-</span><span class="identifier">intervals</span></code>, <code class="computeroutput"><span class="identifier">bk_plus_qm</span></code>
622         and <code class="computeroutput"><span class="identifier">bk_plus_vbar</span></code></a> options
623         all alter the syntax, while the <a class="link" href="../ref/syntax_option_type/syntax_option_type_basic.html" title="Options for POSIX Basic Regular Expressions"><code class="computeroutput"><span class="identifier">collate</span></code> and <code class="computeroutput"><span class="identifier">icase</span></code>
624         options</a> modify how the case and locale sensitivity are to be applied.
625       </p>
626 <h4>
627 <a name="boost_regex.syntax.basic_syntax.h21"></a>
628         <span class="phrase"><a name="boost_regex.syntax.basic_syntax.references"></a></span><a class="link" href="basic_syntax.html#boost_regex.syntax.basic_syntax.references">References</a>
629       </h4>
630 <p>
631         <a href="http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap09.html" target="_top">IEEE
632         Std 1003.1-2001, Portable Operating System Interface (POSIX ), Base Definitions
633         and Headers, Section 9, Regular Expressions (FWD.1).</a>
634       </p>
635 <p>
636         <a href="http://www.opengroup.org/onlinepubs/000095399/utilities/grep.html" target="_top">IEEE
637         Std 1003.1-2001, Portable Operating System Interface (POSIX ), Shells and
638         Utilities, Section 4, Utilities, grep (FWD.1).</a>
639       </p>
640 <p>
641         <a href="http://www.gnu.org/software/emacs/" target="_top">Emacs Version 21.3.</a>
642       </p>
643 </div>
644 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
645 <td align="left"></td>
646 <td align="right"><div class="copyright-footer">Copyright &#169; 1998-2013 John Maddock<p>
647         Distributed under the Boost Software License, Version 1.0. (See accompanying
648         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>)
649       </p>
650 </div></td>
651 </tr></table>
652 <hr>
653 <div class="spirit-nav">
654 <a accesskey="p" href="basic_extended.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="character_classes.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
655 </div>
656 </body>
657 </html>