Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.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:由Regex操作的组件_Objective C_Regex_Ios_Match - Fatal编程技术网

Objective c 目标C:由Regex操作的组件

Objective c 目标C:由Regex操作的组件,objective-c,regex,ios,match,Objective C,Regex,Ios,Match,可能有一些简单的答案,但我没能找到。我正在使用RegexKitLite操作iPhone应用程序中的一些NSString。我想从一个网页的整个HTML源中获取一组链接。我希望它返回链接数组,而不是其余的 我的代码: NSString *regex = @"[0-9]{1,}.htm"; for (NSString *match in [sourcePage componentsSeperatedByRegex: regex]{ NSLog (@"%@", match); // Just t

可能有一些简单的答案,但我没能找到。我正在使用RegexKitLite操作iPhone应用程序中的一些NSString。我想从一个网页的整个HTML源中获取一组链接。我希望它返回链接数组,而不是其余的

我的代码:

NSString *regex = @"[0-9]{1,}.htm";
for (NSString *match in [sourcePage componentsSeperatedByRegex: regex]{
    NSLog (@"%@", match); // Just to debug, will use data later.
}
这里的问题是,enire页面以小块的形式返回,但完全没有我想要的字符串。
感谢您的帮助

改用
-componentsMatchedByRegex:

是!这正是我需要的简单答案!谢谢!