我正在寻找文本中所有出现的字符串,但我不明白为什么代码不起作用。在文中,有2次出现。正则表达式Objective-c
文本:
<div class="infosLigneDetail pointer" onclick="javascript:toggleForfait('1');">
Alexandre OUICHER - Forfait Free illimité à 19,99 euros - 0627505460 <input
搜索字符串:
Alexandre OUICHER - Forfait Free illimité à 19,99 euros - 0627505460
正则表达式:
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])];
你知道问题出在哪里?
没有错误。字符串未找到 – 2012-04-25 00:05:31