//获取webView中的所有图片URL- (NSArray *) getImageurlFromHtml:(NSString *) webString{ NSMutableArray * imageurlArray = [NSMutableArray arrayWithCapacity:1]; //标签匹配 NSString *parten = @" "; NSError* error = NULL; NSRegularExpression *reg = [NSRegularExpression regularExpressionWithPattern:parten options:0 error:&error]; NSArray* match = [reg matchesInString:webString options:0 range:NSMakeRange(0, [webString length] - 1)]; for (NSTextCheckingResult * result in match) { //过去数组中的标签 NSRange range = [result range]; NSString * subString = [webString substringWithRange:range]; //从图片中的标签中提取ImageURL NSRegularExpression *subReg = [NSRegularExpression regularExpressionWithPattern:@"http://(.*?)\"" options:0 error:NULL]; NSArray* match = [subReg matchesInString:subString options:0 range:NSMakeRange(0, [subString length] - 1)]; NSTextCheckingResult * subRes = match[0]; NSRange subRange = [subRes range]; subRange.length = subRange.length -1; NSString * imagekUrl = [subString substringWithRange:subRange]; //将提取出的图片URL添加到图片数组中 [imageurlArray addObject:imagekUrl]; } return imageurlArray;}