I'm having a problem setting up a two word QRegExp. In Example #1 I'm able to pick out USER from str1. However, in Example #2 I'm not able to pick out USER ACTION:
What am I doing wrong? Thanks!
EXAMPLE #1:
int ireturn = reg.indexIn(str, 0);
std::cout << ireturn << std::endl;
ireturn = reg.indexIn(str1, 0);
std::cout << ireturn << std::endl;
QString captured
= reg.
cap( 0 );
// captured == "letter" std::cout << captured.toStdString() << std::endl;
QString str = "User Action:";
QString str1 = "USER ACTION:";
QRegExp reg ("^\\bUSER\\b");
int ireturn = reg.indexIn(str, 0);
std::cout << ireturn << std::endl;
ireturn = reg.indexIn(str1, 0);
std::cout << ireturn << std::endl;
QString captured = reg.cap( 0 ); // captured == "letter"
std::cout << captured.toStdString() << std::endl;
To copy to clipboard, switch view to plain text mode
EXAMPLE #2:
QRegExp reg
("^\\bUSER\\b\\s\\bACTION:\\b");
int ireturn = reg.indexIn(str, 0);
std::cout << ireturn << std::endl;
ireturn = reg.indexIn(str1, 0);
std::cout << ireturn << std::endl;
QString captured
= reg.
cap( 0 );
// captured == "letter" std::cout << captured.toStdString() << std::endl;
QString str = "User Action:";
QString str1 = "USER ACTION:";
QRegExp reg ("^\\bUSER\\b\\s\\bACTION:\\b");
int ireturn = reg.indexIn(str, 0);
std::cout << ireturn << std::endl;
ireturn = reg.indexIn(str1, 0);
std::cout << ireturn << std::endl;
QString captured = reg.cap( 0 ); // captured == "letter"
std::cout << captured.toStdString() << std::endl;
To copy to clipboard, switch view to plain text mode
Bookmarks