| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <title>Boost.Regex: Index</title> |
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
|---|
| 6 | <link rel="stylesheet" type="text/css" href="../../../boost.css"> |
|---|
| 7 | </head> |
|---|
| 8 | <body> |
|---|
| 9 | <P> |
|---|
| 10 | <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0"> |
|---|
| 11 | <TR> |
|---|
| 12 | <td valign="top" width="300"> |
|---|
| 13 | <h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../boost.png" border="0"></a></h3> |
|---|
| 14 | </td> |
|---|
| 15 | <TD width="353"> |
|---|
| 16 | <H1 align="center">Boost.Regex</H1> |
|---|
| 17 | <H2 align="center">The "Leftmost Longest" Rule</H2> |
|---|
| 18 | </TD> |
|---|
| 19 | <td width="50"> |
|---|
| 20 | <h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3> |
|---|
| 21 | </td> |
|---|
| 22 | </TR> |
|---|
| 23 | </TABLE> |
|---|
| 24 | </P> |
|---|
| 25 | <HR> |
|---|
| 26 | <p></p> |
|---|
| 27 | <P>Often there is more than one way of matching a regular expression at a |
|---|
| 28 | particular location, for POSIX basic and extended regular expressions, the |
|---|
| 29 | "best" match is determined as follows:</P> |
|---|
| 30 | <OL> |
|---|
| 31 | <LI> |
|---|
| 32 | Find the leftmost match, if there is only one match possible at this location |
|---|
| 33 | then return it.</LI> |
|---|
| 34 | <LI> |
|---|
| 35 | Find the longest of the possible matches, along with any ties. If there |
|---|
| 36 | is only one such possible match then return it.</LI> |
|---|
| 37 | <LI> |
|---|
| 38 | If there are no marked sub-expressions, then all the remaining alternatives are |
|---|
| 39 | indistinguishable; return the first of these found.</LI> |
|---|
| 40 | <LI> |
|---|
| 41 | Find the match which has matched the first sub-expression in the leftmost |
|---|
| 42 | position, along with any ties. If there is only on such match possible |
|---|
| 43 | then return it.</LI> |
|---|
| 44 | <LI> |
|---|
| 45 | Find the match which has the longest match for the first sub-expression, along |
|---|
| 46 | with any ties. If there is only one such match then return it.</LI> |
|---|
| 47 | <LI> |
|---|
| 48 | Repeat steps 3 and 4 for each additional marked sub-expression.</LI> |
|---|
| 49 | <LI> |
|---|
| 50 | If there is still more than one possible match remaining, then they are |
|---|
| 51 | indistinguishable; return the first one found.</LI></OL> |
|---|
| 52 | <P> |
|---|
| 53 | <HR> |
|---|
| 54 | <P></P> |
|---|
| 55 | <p>Revised |
|---|
| 56 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> |
|---|
| 57 | 16 Dec 2004</p> |
|---|
| 58 | <p><i>© Copyright John Maddock 1998- |
|---|
| 59 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p> |
|---|
| 60 | <P><I>Use, modification and distribution are subject to the Boost Software License, |
|---|
| 61 | Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> |
|---|
| 62 | or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P> |
|---|
| 63 | </body> |
|---|
| 64 | </html> |
|---|
| 65 | |
|---|