Regex: Fix handling of match_prev_avail for boost regex
We were passing around iterators that were not allowed to go before the begin iterator.
This commit is contained in:
parent
9ec376135b
commit
08ea68dc1f
|
@ -180,7 +180,8 @@ bool regex_search(It begin, It end, const Regex& re,
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool matched = boost::regex_search<RegexUtf8It<It>>({begin, begin, end}, {end, begin, end}, re, flags);
|
auto first = (flags & RegexConstant::match_prev_avail) ? begin-1 : begin;
|
||||||
|
bool matched = boost::regex_search<RegexUtf8It<It>>({begin, first, end}, {end, first, end}, re, flags);
|
||||||
if (re.impl() and matched != regex_search(begin, end, *re.impl(), convert_flags(flags)))
|
if (re.impl() and matched != regex_search(begin, end, *re.impl(), convert_flags(flags)))
|
||||||
regex_mismatch(re);
|
regex_mismatch(re);
|
||||||
return matched;
|
return matched;
|
||||||
|
@ -197,7 +198,8 @@ bool regex_search(It begin, It end, MatchResults<It>& res, const Regex& re,
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool matched = boost::regex_search<RegexUtf8It<It>>({begin, begin, end}, {end, begin, end}, res, re, flags);
|
auto first = (flags & RegexConstant::match_prev_avail) ? begin-1 : begin;
|
||||||
|
bool matched = boost::regex_search<RegexUtf8It<It>>({begin, first, end}, {end, first, end}, res, re, flags);
|
||||||
Vector<It> captures;
|
Vector<It> captures;
|
||||||
if (re.impl() and matched != regex_search(begin, end, captures, *re.impl(), convert_flags(flags)))
|
if (re.impl() and matched != regex_search(begin, end, captures, *re.impl(), convert_flags(flags)))
|
||||||
regex_mismatch(re);
|
regex_mismatch(re);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user