Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.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中的正则表达式_Objective C_Regex - Fatal编程技术网

Objective-c中的正则表达式

Objective-c中的正则表达式,objective-c,regex,Objective C,Regex,我正在查找文本中字符串的所有匹配项,但我不明白为什么代码不起作用。在文本中,出现了两种情况 案文: <div class="infosLigneDetail pointer" onclick="javascript:toggleForfait('1');"> Alexandre OUICHER - Forfait Free illimité à 19,99 euros - 0627505460 &l

我正在查找文本中字符串的所有匹配项,但我不明白为什么代码不起作用。在文本中,出现了两种情况

案文:

<div class="infosLigneDetail pointer" onclick="javascript:toggleForfait('1');">
                    Alexandre OUICHER - Forfait Free illimité à 19,99 euros - 0627505460                        <input
正则表达式:

NSRegularExpression *regexpComptes = [NSRegularExpression regularExpressionWithPattern:@"(?<=javascript:toggleForfait('[0-9]');\">).*?(?=<input)" options:NSRegularExpressionSearch error:NULL];
NSArray *matchesComptes = [regexpComptes matchesInString:content
                                                   options:0
                                                     range:NSMakeRange(0, [content length])];

NSRegularExpression*regexpComptes=[NSRegularExpression regular expression with pattern:@”(您没有在
toggleForfait(“[0-9]”)中逃逸
分别是
toggleForfait\(“[0-9]”)


您需要的正则表达式是
(?没有错误。找不到字符串。谢谢。也谢谢您链接到regexr.com。我知道air中的工具,但不知道链接。感谢nsregularexpressiondotmatcheslineseparator的dotall枚举值。
NSRegularExpression *regexpComptes = [NSRegularExpression regularExpressionWithPattern:@"(?<=javascript:toggleForfait('[0-9]');\">).*?(?=<input)" options:NSRegularExpressionSearch error:NULL];
NSArray *matchesComptes = [regexpComptes matchesInString:content
                                                   options:0
                                                     range:NSMakeRange(0, [content length])];