0

I need to build a regular expression to match the following set of strings :

test, tested, testing

And I have the following test scenario :

QRegularExpression re("^[test]{1}[ing|ed]{0,1}", QRegularExpression::CaseInsensitiveOption);

QString test = "test";
QVERIFY(re.match(test).hasMatch() == true );

QString test1 = "tested";
QVERIFY(re.match(test1).hasMatch() == true );

QString test2 = "testing";
QVERIFY(re.match(test2).hasMatch() == true );

QString test3 = "teste";
QVERIFY(re.match(test3).hasMatch() == false );

test3 is failed and I understand the reason, but how can I fix it? I need to skip 'e' character from matching...

eyllanesc
  • 221,139
  • 17
  • 121
  • 189
Dmitry
  • 1,824
  • 1
  • 16
  • 26

0 Answers0