Implement wxRegEx using PCRE

Adjust the tests and document the incompatibilities with the previously
used regex syntax.

In this commit the use of PCRE is conditional on wxUSE_PCRE which is
never defined as 1 yet, so the new code is still disabled.
This commit is contained in:
Vadim Zeitlin
2021-07-17 17:00:19 +02:00
parent 912f4b76ac
commit fa59d5700a
5 changed files with 809 additions and 42 deletions

View File

@@ -59,7 +59,7 @@ TEST_CASE("wxRegEx::Compile", "[regex][compile]")
CHECK_FALSE( re.Compile("foo[") );
CHECK_FALSE( re.Compile("foo[bar") );
CHECK ( re.Compile("foo[bar]") );
CHECK_FALSE( re.Compile("foo{1") );
// Not invalid for PCRE: CHECK_FALSE( re.Compile("foo{1") );
CHECK ( re.Compile("foo{1}") );
CHECK ( re.Compile("foo{1,2}") );
CHECK ( re.Compile("foo*") );
@@ -184,4 +184,20 @@ TEST_CASE("wxRegEx::ConvertFromBasic", "[regex][basic]")
CHECK( wxRegEx::ConvertFromBasic("[^$\\)]") == "[^$\\)]" );
}
#ifdef wxHAS_REGEX_ADVANCED
TEST_CASE("wxRegEx::Unicode", "[regex][unicode]")
{
const wxString cyrillicCapitalA(L"\u0410");
const wxString cyrillicSmallA(L"\u0430");
wxRegEx re(cyrillicCapitalA, wxRE_ICASE);
REQUIRE( re.IsValid() );
REQUIRE( re.Matches(cyrillicSmallA) );
CHECK( re.GetMatch(cyrillicSmallA) == cyrillicSmallA );
}
#endif // wxHAS_REGEX_ADVANCED
#endif // wxUSE_REGEX