我正在做一个正则表达式以下行:NSRegularExpression不匹配
Table 'Joella VIII' 6-max Seat #4 is the button
到目前为止,我有这样的:
self.tableDetailsRegex = [NSRegularExpression regularExpressionWithPattern:@"Table '[A-Za-z0-9 ]*' [0-9]+-max Seat #[0-9]+ is the button" options:NSRegularExpressionAllowCommentsAndWhitespace error:nil];
if([self.tableDetailsRegex numberOfMatchesInString:line options:NSMatchingReportCompletion range:NSMakeRange(0, line.length)] == 1)
{
NSLog(@"%@", line);
}
所以,我的正则表达式为:
Table '[A-Za-z0-9 ]*' [0-9]+-max Seat #[0-9]+ is the button
而且我敢肯定,所选线路在某些时候来的,因为我打印所有行远一点在我的代码...
FWIW,如果我复制/粘贴您的模式和测试字符串到我的工具,它确实匹配。相对于“if”的问题? – Seki