[Qt-interest] about QRegExp
Bob Hood
bhood2 at comcast.net
Mon Nov 22 05:09:06 CET 2010
On 11/21/2010 8:37 PM, tang ke wrote:
> I have a string about %%FOOTBALL{XXXXX} YYYYY,and I want to replace this
> to \football{XXXX}{YYYY}
>
> but when I use the QRegExp string "%%FOOTBALL{\(.*\)}\(.*\)" to
> "\\football{\\1}{\\2}"
>
> but It's fail.
>
> can you help me?
QRegExp find_football("%%FOOTBALL\\s*\\{(.*)\\}\\s*(.*)");
index = find_footballindexIn("%%FOOTBALL{XXXXX} YYYYY", 0);
if(index >= 0)
{
QString new_football = QString("\\\\football {%1}
{%2}").arg(test.cap(1)).arg(test.cap(2));
...
}
Render me gone, |||
Bob ^(===)^
---------------------------------oOO--(_)--OOo---------------------------------
Character is more easily kept than recovered.
More information about the Qt-interest-old
mailing list