这是我的代码:
std::string captured;
if (RE2::PartialMatch("a b--b c", "(?:a b(?P<Contents>[^b]+)b)?", &captured)) {
printf("match: %s\n", captured.c_str());
}
它打印:
match: --
正如预期的那样。然后我将第一个参数更改为“a b--b c”(在开头添加了空格)。现在它打印:
match:
错误的匹配。这是错误还是预期的行为?
谢谢你。