\r\nThis PM was sent by [ helloworld ] helloworld@gmail.com,\r\nMembership Status : Non-Verified Member\r\nhttp://www.gg.com/A/F/U.asp?UserID=helloworld@1\r\n\r\n\r\n\r\n\r\n\r\nHi, may i know does the item still available?\r\n\r\n\r\n\r\n *** This email was sent using www.gg.com***
NSString *regexStr = @"@1(.*?)[\\*]";
NSError *error;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regexStr options:NSRegularExpressionCaseInsensitive error:&error];
NSArray *matches = [regex matchesInString:message options:NSMatchingReportCompletion range:NSMakeRange(0, [message length])];
if ([matches count] > 0) {
for (NSTextCheckingResult *match in matches) {
NSString* matchText = [message substringWithRange:[match range]];
NSLog(@"match: %@", matchText);
NSRange group1 = [match rangeAtIndex:1];
NSLog(@"group1: %@", [message substringWithRange:group1]);
}
}
Я хочу получить "Привет, могу ли я знать, что предмет еще доступен?"из строки выше в Objective-C