查找使用正则模式不匹配的字符串
我想为无与伦比的字符串返回一个布尔值,
QRegExp rx("(?!test)");
bool unmatched = rx.exactMatch("txt"); false
if(rx.isValid()){
return unmatched;
}
无论传递哪个字符串,它每次都会返回false。如何匹配相同的值?
I want to return a bool value for the unmatched string
QRegExp rx("(?!test)");
bool unmatched = rx.exactMatch("txt"); false
if(rx.isValid()){
return unmatched;
}
It returns false every time no matter what string is passed. How can I match the same values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定您要准确地做什么,但是您可以在输入字符串上迭代并在任何一个不匹配给定模式时做某事。
请注意,我正在使用
std :: copy_if
(C ++ 17),但您不需要。[demo]
Not sure what you want to do exactly but you could iterate over the input strings and do something when any of them doesn't match a given pattern.
Notice I'm using
std::copy_if
(C++17) below, but you shouldn't need to.[Demo]