如果找不到结果,我怎样才能将字符串设置为“Missing”
NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:@"\\d{4}-\\d{4}"options:NSRegularExpressionCaseInsensitive error:NULL];
NSString *someString = result;
NSString *match = [someString substringWithRange:[expression rangeOfFirstMatchInString:someString options:NSMatchingCompleted
range:NSMakeRange(0, [someString length])]];
此代码搜索字符串并提取文本。