我有一个检查功能,输入的行是否为“OK”。
#include <tr1/regex>
bool lineIsValid(string line) {
const tr1::regex pattern("[^-]{1,30} - [^-]{1,30}");
return tr1::regex_match(line, pattern);
}
lineIsValid("test - test");
该函数返回假。为什么?
我有一个检查功能,输入的行是否为“OK”。
#include <tr1/regex>
bool lineIsValid(string line) {
const tr1::regex pattern("[^-]{1,30} - [^-]{1,30}");
return tr1::regex_match(line, pattern);
}
lineIsValid("test - test");
该函数返回假。为什么?