我想匹配输入字段中给出的字符串。
A sample data could be "hello" -> returns true
or "\"" -> returns true
or "this is a string" -> returns true
but """ should not be recognized as a string and should return false when checked by the regexp.
我正在初始化一个 boost 正则表达式解析器,如下所示:
std::string myString = "\"\"\"";
boost::smatch match;
boost::regex regExpString3("[\"']((:?[^\"']|\\\")+?)[\"']");
bool statusString3 = boost::regex_match(myString, match, regExpString3);
regex_match 不应该匹配,但不幸的是它匹配......
我检查了几个在线正则表达式测试器:我的正则表达式不匹配(如预期的那样)。
知道这可能是提升的错误还是我做错了什么?
Debuggex Demo:点我验证("[\"']((:?[^\"']|\\")+?)[\"']"
谢谢