mu-regex: add match_groups, use everywhere
Add match_groups to Mu::Regex, and update old "raw" GRegex users.
This commit is contained in:
@ -402,9 +402,7 @@ message(const Regex& rx, size_t id)
|
||||
char buf[16];
|
||||
::snprintf(buf, sizeof(buf), "%zu", id);
|
||||
|
||||
return to_string_gchar(
|
||||
g_regex_replace(rx, test_msg, -1, 0, buf,
|
||||
G_REGEX_MATCH_DEFAULT, {}));
|
||||
return unwrap(rx.replace(test_msg, buf));
|
||||
}
|
||||
|
||||
struct TestData {
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#include "utils/mu-utils.hh"
|
||||
#include "utils/mu-utils-file.hh"
|
||||
#include "utils/mu-result.hh"
|
||||
#include "utils/mu-regex.hh"
|
||||
|
||||
using namespace Mu;
|
||||
|
||||
@ -135,7 +136,7 @@ test_maildir_mkdir_05(void)
|
||||
[[maybe_unused]] static void
|
||||
assert_matches_regexp(const char* str, const char* rx)
|
||||
{
|
||||
if (!g_regex_match_simple(rx, str, (GRegexCompileFlags)0, (GRegexMatchFlags)0)) {
|
||||
if (const auto rex{Regex::make(rx)}; !rex || !rex->matches(str)) {
|
||||
if (g_test_verbose())
|
||||
g_print("%s does not match %s", str, rx);
|
||||
g_assert(0);
|
||||
|
||||
Reference in New Issue
Block a user