Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.8.2
-
None
-
Windows 7 64bit Japanese Edition
Qt 4.8.2
QtCreator 2.5.2
Description
When I tried to know the index of the QString in QStringList,
"^" doesn't work well.
I expected that the pattern "^TEST" works.
I checked it with QString, too. It works.
Following code can duplicate the situation.
{ QStringList testList; QRegExp testReg; int rslt; testList << "abc" << "REG_EXP_TEST" << "TEST_STRING"; // search the index of QString which starts with "TEST" testReg.setPattern("^TEST"); rslt = testList.indexOf(testReg); // rslt == -1. Can not find testReg.setPattern("^TEST*"); rslt = testList.indexOf(testReg); // rslt == -1. Can not find testReg.setPattern("^TEST.*"); rslt = testList.indexOf(testReg); // rslt == 2. Works. } { QString testString; QRegExp testReg; int rslt; testString = tr("TEST_STRING"); testReg.setPattern("^TEST"); rslt = testString.indexOf(testReg); // rslt == 0. Works }