I've found but how to use
The regular expression I've found by the position it starts can be any length long.
What is the convinient way to get it all into a string? It's starting position in the mother string is not enough knowlege, you see.
I.m working with QFile QTextStream QRegExp objects.
Probably another tech should be used or can you open my eyes on methods I've missed?
Re: I've found but how to use
3 Attachment(s)
Re: I've found but how to use
Thank you JPN. It helps:
see regexp1.png
Now experiencing problems while splitting the founded expression(number1 / number2 into QStringList "number1" , "number2" ) using Qstring str.split(" \ / ") code line:
see regexp10.png.
Probably, I' ve made a mistake, but
I can not retrieve correct results from help code example also:
http://doc.trolltech.com/4.4/qregexp.html#capturedTexts :
see regexp2.png
How can it be possible to cut founded end extracted( thks to JPN) regular expression into
QStringList by
Qstring str.split(..)
or
Qregexp rx;
QStringList rx.capturedTexts();
or any other way?
Re: I've found but how to use
that code works
Code:
qDebug
() <<
QString("number1 / number2").
split(" / ");
//("number1", "number2")
or I didn't understand something?
Re: I've found but how to use
You are right. It works. I couldn't see it becouse hadn't iterated through returned QStringList object properly.
You Returned it to... QDebug(). What is it and waht you could see then ?
Re: I've found but how to use
the result of this code is
Quote:
("number1", "number2")
in your case