I have found a solution suiting me.
QRegularExpression rexp ( "<img src=\\\"([^\\\"]{1,})([^/]{0,})/>" );
QRegularExpressionMatch match;
int pos = content.indexOf ( rexp, pos + 1 ) ;
if ( pos > -1 )
{
match = rexp.match ( content, pos );
if ( match.isValid() )
{
QString imFile = match.captured ( 1 );
}
}
imFile will hold the file name stored.
Or as alternative for the deprecated QRegExp. The expression itself works for both.
QRegExp rexp ( "<img src=\\\"([^\\\"]{1,})([^/]{0,})/>" );
int pos = content.indexOf ( rexp );
if ( pos >= 0)
{
QString imFile = rexp.cap ( 1 );
}
Note: The indexOf with QRegularExpression may also handle the QRegularExpressionMatch since version 5.5. This would make it more compact.