I am parsing a file which contains following packets:
[propertyID="123000"] {
fillColor : #f3f1ed;
minSize : 5;
lineWidth : 3;
}
To scan just this [propertyID="123000"]
fragment I havre this QRegExp
QRegExp("^\b\[propertyID=\"c+\"\]\b");
but that does not work? Here I have example code to parse that file above:
QRegExp propertyIDExp= QRegExp("\\[propertyID=\".*\"]");
propertyIDExp.setMinimal(true);
QFile inputFile(fileName);
if (inputFile.open(QIODevice::ReadOnly))
{
QTextStream in(&inputFile);
while (!in.atEnd())
{
QString line = in.readLine();
// if does not catch if line is for instance
// [propertyID="123000"] {
if( line.contains(propertyIDExp) )
{
//.. further processing
}
}
inputFile.close();
}