leftmost_longest_rule.html 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <html>
  2. <head>
  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.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="collating_names/named_unicode.html" title="Named Unicode Characters">
  10. <link rel="next" href="../format.html" title="Search and Replace Format String Syntax">
  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="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>
  24. </div>
  25. <div class="section">
  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
  28. Longest Rule</a>
  29. </h3></div></div></div>
  30. <p>
  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:
  34. </p>
  35. <div class="orderedlist"><ol class="orderedlist" type="1">
  36. <li class="listitem">
  37. Find the leftmost match, if there is only one match possible at this
  38. location then return it.
  39. </li>
  40. <li class="listitem">
  41. Find the longest of the possible matches, along with any ties. If there
  42. is only one such possible match then return it.
  43. </li>
  44. <li class="listitem">
  45. If there are no marked sub-expressions, then all the remaining alternatives
  46. are indistinguishable; return the first of these found.
  47. </li>
  48. <li class="listitem">
  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
  51. then return it.
  52. </li>
  53. <li class="listitem">
  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.
  56. </li>
  57. <li class="listitem">
  58. Repeat steps 4 and 5 for each additional marked sub-expression.
  59. </li>
  60. <li class="listitem">
  61. If there is still more than one possible match remaining, then they are
  62. indistinguishable; return the first one found.
  63. </li>
  64. </ol></div>
  65. </div>
  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 &#169; 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>)
  71. </p>
  72. </div></td>
  73. </tr></table>
  74. <hr>
  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>
  77. </div>
  78. </body>
  79. </html>