3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>The Leftmost Longest Rule
</title>
5 <link rel=
"stylesheet" href=
"../../../../../../doc/src/boostbook.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../../index.html" title=
"Boost.Regex 5.1.2">
8 <link rel=
"up" href=
"../syntax.html" title=
"Regular Expression Syntax">
9 <link rel=
"prev" href=
"collating_names/named_unicode.html" title=
"Named Unicode Characters">
10 <link rel=
"next" href=
"../format.html" title=
"Search and Replace Format String 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=
"collating_names/named_unicode.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=
"../format.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.leftmost_longest_rule"></a><a class=
"link" href=
"leftmost_longest_rule.html" title=
"The Leftmost Longest Rule">The Leftmost
29 </h3></div></div></div>
31 Often there is more than one way of matching a regular expression at a particular
32 location, for POSIX basic and extended regular expressions, the
"best"
33 match is determined as follows:
35 <div class=
"orderedlist"><ol class=
"orderedlist" type=
"1">
37 Find the leftmost match, if there is only one match possible at this
38 location then return it.
41 Find the longest of the possible matches, along with any ties. If there
42 is only one such possible match then return it.
45 If there are no marked sub-expressions, then all the remaining alternatives
46 are indistinguishable; return the first of these found.
49 Find the match which has matched the first sub-expression in the leftmost
50 position, along with any ties. If there is only on such match possible
54 Find the match which has the longest match for the first sub-expression,
55 along with any ties. If there is only one such match then return it.
58 Repeat steps
4 and
5 for each additional marked sub-expression.
61 If there is still more than one possible match remaining, then they are
62 indistinguishable; return the first one found.
66 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
67 <td align=
"left"></td>
68 <td align=
"right"><div class=
"copyright-footer">Copyright
© 1998-
2013 John Maddock
<p>
69 Distributed under the Boost Software License, Version
1.0. (See accompanying
70 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>)
75 <div class=
"spirit-nav">
76 <a accesskey=
"p" href=
"collating_names/named_unicode.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=
"../format.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>