Originally Posted by
tuthmosis
Sorry but i had my reasons to ask... I know regexp, no need to insult me.
If i ask it's because normal regexp don't seam to be compatible with QRegExp.
Well you didn't ask the following in the first time!
For my need, the following should work.
(?<=<TH>)([a-zA-Z0-9 ])+(?=</TD>)
Applied to <TH>test</TD> ... this pattern will return <TH>test... so the backward lookup doesn't seem to be implemented.
Yes, not all is implemented, but one can achieve all with some extra work.
QString str
= "<TH>test</TD> foo <TH>bar</TD>";
QRegExp rx
("<TH>([a-zA-Z0-9 ]+)</TD>");
int pos = 0;
while ((pos = rx.indexIn(str, pos)) != -1)
{
list << rx.cap(1);
pos += rx.matchedLength();
}
qWarning() << list; // ("test", "bar")
QString str = "<TH>test</TD> foo <TH>bar</TD>";
QRegExp rx("<TH>([a-zA-Z0-9 ]+)</TD>");
QStringList list;
int pos = 0;
while ((pos = rx.indexIn(str, pos)) != -1)
{
list << rx.cap(1);
pos += rx.matchedLength();
}
qWarning() << list; // ("test", "bar")
To copy to clipboard, switch view to plain text mode
Bookmarks