Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 目的研究c调节基因的表达_Objective C_Regex - Fatal编程技术网

Objective c 目的研究c调节基因的表达

Objective c 目的研究c调节基因的表达,objective-c,regex,Objective C,Regex,我有一些从html源代码中获取图像的代码 NSError *error; NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(https?)\\S*(png|jpg|jpeg|gif)" options:NSRegularExpressionCas

我有一些从html源代码中获取图像的代码

NSError *error;

NSRegularExpression *regex = [NSRegularExpression         
                              regularExpressionWithPattern:@"(https?)\\S*(png|jpg|jpeg|gif)"
                              options:NSRegularExpressionCaseInsensitive
                              error:&error];

[regex enumerateMatchesInString:htmlstr 
                        options:0 
                          range:NSMakeRange(0, htmlstr.length) 
                     usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
                         [imagesURLStringArray addObject:[htmlstr substringWithRange:result.range]];
                     }];    
我正在努力获得正确的形象,如果链接是像下面

<a href='http://imagelink.jpg'><img src='http://imagesource.jpg'....

如何提取源代码而不是链接


干杯,

我不知道objective-c正则表达式是否支持Lookback。您可以尝试使用此查找:

regularExpressionWithPattern:@"(?<=src=['\"])(https?)\\S*(png|jpg|jpeg|gif)"
                               +------------+

regularExpressionWithPattern:@“(?
@”)(?使用
\s*
的可选空格检查将执行
=
对该案例进行签名。您不能在查找后断言中使用
*