[Qt-interest] Problem with RegExp extraction value from Json kind of response
Meir Yanovich
meiry242 at gmail.com
Thu Mar 25 08:32:20 CET 2010
Hello all
im trying to extract value by key from http Json kind of struct by using
simple RegExp
here is my code i like to extract the key value from the string:
QString http_response =
"{\"key\":\"a99fdd865c2-10000\",\"oid\":1000055,\"expires\":0000,\"secret\":\"509c03edfdc7\",\"sign\":\"f0dd9e5226d0e77\"}";
// or even if i use QRegExp::escape on the string it dosn't work
QRegExp rx("\"key\"\:(.*?)\",");
int yy = rx.indexIn(http_response);
QString cap = rx.cap(1);
but i cant capture the string and the yy variable always gives me -1
i tested this regexp in this regexp tester : http://gskinner.com/RegExr/ and
its working fine
what im doing wrong here ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100325/829634b4/attachment.html
More information about the Qt-interest-old
mailing list