I have this regex
([0-9]+)\(([0-9]+),([0-9]+)\)
which I use to build NSRegularExpression without parameters (0). This expression must match strings of type
1(135,252)
and we get three matches: 1, 135, 252. Now I confirmed with debuggex.com that the expression is correct and does what I want. However, iOS refuses to acknowledge my efforts and the following code.
NSString *nodeString = @"1(135,252)"; NSArray *r = [nodeRegex matchesInString:nodeString options:0 range:NSMakeRange(0, nodeString.length)]; NSLog(@"--- %@", nodeString); for(NSTextCheckingResult *t in r) { for(int i = 0; i < t.numberOfRanges; i++) { NSLog(@"%@", [nodeString substringWithRange:[t rangeAtIndex:i]]); } }
insists on saying
which is clearly wrong.
Thoughts?
source share