NSRegularExpression to extract text between two XML tags
How to extract the value "6" between the "badgeCount" tags using NSRegularExpression. Following is the response from the server: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><badgeCount>6</badgeCount><rank>2</rank><screenName>myName</screenName> Following is the code I tried but not getting success. Actually it goes in else part and prints "Value of regex is nil": NSString *responseString = [[NSString alloc] initWithBytes:[responseDataForCrntUser bytes] length:responseDataForCrntUser.length encoding:NSUTF8StringEncoding]; NSError *error; NSRegularExpression *regex =