mirror of
https://github.com/boostorg/regex.git
synced 2025-07-17 14:22:08 +02:00
Allow match_results::position() to return a valid value for partial matches.
[SVN r34324]
This commit is contained in:
@ -27,8 +27,11 @@
|
|||||||
<P>Boost 1.34</P>
|
<P>Boost 1.34</P>
|
||||||
<UL>
|
<UL>
|
||||||
<LI>
|
<LI>
|
||||||
Fix for non-greedy repeats and partial matches not working correctly in some cases.
|
Fix for non-greedy repeats and partial matches not working correctly in some
|
||||||
</LI>
|
cases.
|
||||||
|
<LI>
|
||||||
|
Changed match_results::position() to return a valid result when *this
|
||||||
|
represents a partial match.</LI>
|
||||||
</UL>
|
</UL>
|
||||||
<P>Boost 1.33.1</P>
|
<P>Boost 1.33.1</P>
|
||||||
<UL>
|
<UL>
|
||||||
@ -169,4 +172,3 @@
|
|||||||
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
@ -300,7 +300,9 @@ difference_type position(unsigned int sub = 0)const;
|
|||||||
</pre>
|
</pre>
|
||||||
<b></b>
|
<b></b>
|
||||||
<p><b>Effects:</b> Returns the starting location of sub-expression <EM>sub</EM>,
|
<p><b>Effects:</b> Returns the starting location of sub-expression <EM>sub</EM>,
|
||||||
or -1 if <EM>sub</EM> was not matched <code>.</code></p>
|
or -1 if <EM>sub</EM> was not matched. Note that if this represents a <A href="partial_matches.html">
|
||||||
|
partial match</A> , then <code>position()</code> will return the location of
|
||||||
|
the partial match even though <code>(*this)[0].matched</code> is <EM>false</EM>.</p>
|
||||||
<pre><A name=m6></A>
|
<pre><A name=m6></A>
|
||||||
string_type str(int sub = 0)const;
|
string_type str(int sub = 0)const;
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -27,8 +27,11 @@
|
|||||||
<P>Boost 1.34</P>
|
<P>Boost 1.34</P>
|
||||||
<UL>
|
<UL>
|
||||||
<LI>
|
<LI>
|
||||||
Fix for non-greedy repeats and partial matches not working correctly in some cases.
|
Fix for non-greedy repeats and partial matches not working correctly in some
|
||||||
</LI>
|
cases.
|
||||||
|
<LI>
|
||||||
|
Changed match_results::position() to return a valid result when *this
|
||||||
|
represents a partial match.</LI>
|
||||||
</UL>
|
</UL>
|
||||||
<P>Boost 1.33.1</P>
|
<P>Boost 1.33.1</P>
|
||||||
<UL>
|
<UL>
|
||||||
@ -169,4 +172,3 @@
|
|||||||
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
@ -300,7 +300,9 @@ difference_type position(unsigned int sub = 0)const;
|
|||||||
</pre>
|
</pre>
|
||||||
<b></b>
|
<b></b>
|
||||||
<p><b>Effects:</b> Returns the starting location of sub-expression <EM>sub</EM>,
|
<p><b>Effects:</b> Returns the starting location of sub-expression <EM>sub</EM>,
|
||||||
or -1 if <EM>sub</EM> was not matched <code>.</code></p>
|
or -1 if <EM>sub</EM> was not matched. Note that if this represents a <A href="partial_matches.html">
|
||||||
|
partial match</A> , then <code>position()</code> will return the location of
|
||||||
|
the partial match even though <code>(*this)[0].matched</code> is <EM>false</EM>.</p>
|
||||||
<pre><A name=m6></A>
|
<pre><A name=m6></A>
|
||||||
string_type str(int sub = 0)const;
|
string_type str(int sub = 0)const;
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
if(sub < m_subs.size())
|
if(sub < m_subs.size())
|
||||||
{
|
{
|
||||||
const sub_match<BidiIterator>& s = m_subs[sub];
|
const sub_match<BidiIterator>& s = m_subs[sub];
|
||||||
if(s.matched)
|
if(s.matched || (sub == 2))
|
||||||
{
|
{
|
||||||
return ::boost::re_detail::distance((BidiIterator)(m_base), (BidiIterator)(s.first));
|
return ::boost::re_detail::distance((BidiIterator)(m_base), (BidiIterator)(s.first));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user