objective c - NSRegularExpression doesn't match -
objective c - NSRegularExpression doesn't match -
i'm making regular look next line:
table 'joella viii' 6-max seat #4 button
so far, i've got this:
self.tabledetailsregex = [nsregularexpression regularexpressionwithpattern:@"table '[a-za-z0-9 ]*' [0-9]+-max seat #[0-9]+ button" options:nsregularexpressionallowcommentsandwhitespace error:nil]; if([self.tabledetailsregex numberofmatchesinstring:line options:nsmatchingreportcompletion range:nsmakerange(0, line.length)] == 1) { nslog(@"%@", line); }
so, regular look is:
table '[a-za-z0-9 ]*' [0-9]+-max seat #[0-9]+ button
and i'm sure selected line comes @ point, because i'm printing lines bit farther in code...
your problem in options using. nsregularexpression class reference, nsregularexpressionallowcommentsandwhitespace
means whitespace , after #
in regular look ignored. alternative enabled, regular look acts this:
table'[a-za-z0-9]*'[0-9]+-maxseat
you want pass 0 options, none of them enabled.
self.tabledetailsregex = [nsregularexpression regularexpressionwithpattern:@"table '[a-za-z0-9 ]*' [0-9]+-max seat #[0-9]+ button" options:0 error:nil];
objective-c regex nsregularexpression
Comments
Post a Comment