Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <85>login[2775]: ROOT LOGIN on '/dev/tty1'
- QRegExp re1_1(".*: (?<username>.*) LOGIN.*");
- foreach(const QString& str, strings)
- {
- if(re1_1.exactMatch(str))
- qDebug() << "Found: " << ":" << str;
- }
- .*:s+(.*)s+LOGIN.*
- QString source{"<85>login[2775]: ROOT LOGIN on '/dev/tty1'"};
- QRegExp regexp{R"-(.*:s+(.*)s+LOGIN.*)-"};
- if(regexp.exactMatch(source))
- qDebug() << "The found login is: " << regexp.cap(1);
- QString source{"<85>login[2775]: ROOT LOGIN on '/dev/tty1'"};
- QRegularExpression regexp{R"-(.*?:s+(.*?)s+LOGIN.*)-"};
- QRegularExpressionMatch match = regexp.match(source);
- if(match.hasMatch())
- qDebug() << "The found login is: " << match.captured(1);
- std::string s ("<85>login[2775]: ROOT LOGIN on '/dev/tty1'");
- std::regex e (".*:\s+(.*?)\s+LOGIN.*");
- std::smatch m;
- if(std::regex_search (s,m,e)) std::cout << m[1];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement