mirror of
https://github.com/boostorg/regex.git
synced 2025-07-16 22:02:08 +02:00
Correct behaviour of \b when matching null-strings.
See https://github.com/boostorg/regex/issues/40
This commit is contained in:
@ -476,12 +476,14 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_word_boundary()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
b = (m_match_flags & match_not_eow) ? true : false;
|
if (m_match_flags & match_not_eow)
|
||||||
|
return false;
|
||||||
|
b = false;
|
||||||
}
|
}
|
||||||
if((position == backstop) && ((m_match_flags & match_prev_avail) == 0))
|
if((position == backstop) && ((m_match_flags & match_prev_avail) == 0))
|
||||||
{
|
{
|
||||||
if(m_match_flags & match_not_bow)
|
if(m_match_flags & match_not_bow)
|
||||||
b ^= true;
|
return false;
|
||||||
else
|
else
|
||||||
b ^= false;
|
b ^= false;
|
||||||
}
|
}
|
||||||
|
@ -169,5 +169,30 @@ void test_assertion_escapes()
|
|||||||
TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2028bar", match_default, make_array(0, 4, -2, -2));
|
TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2028bar", match_default, make_array(0, 4, -2, -2));
|
||||||
TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2029bar", match_default, make_array(0, 4, -2, -2));
|
TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2029bar", match_default, make_array(0, 4, -2, -2));
|
||||||
}
|
}
|
||||||
|
// Bug report: https://github.com/boostorg/regex/issues/40
|
||||||
|
TEST_REGEX_SEARCH("\\b", perl, "", match_default, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\b", perl, "", match_not_bow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\b", perl, "", match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\b", perl, "", match_not_bow | match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\b", perl, "-", match_default, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\b", perl, "-", match_not_bow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\b", perl, "-", match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\b", perl, "-", match_not_bow | match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\<", perl, "", match_default, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\<", perl, "", match_not_bow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\<", perl, "", match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\<", perl, "", match_not_bow | match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\<", perl, "-", match_default, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\<", perl, "-", match_not_bow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\<", perl, "-", match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\<", perl, "-", match_not_bow | match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\>", perl, "", match_default, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\>", perl, "", match_not_bow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\>", perl, "", match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\>", perl, "", match_not_bow | match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\>", perl, "-", match_default, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\>", perl, "-", match_not_bow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\>", perl, "-", match_not_eow, make_array(-2, -2));
|
||||||
|
TEST_REGEX_SEARCH("\\>", perl, "-", match_not_bow | match_not_eow, make_array(-2, -2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user