File: syntax_leftmost_longest.html

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