下記のようにやるらしい。後方参照とかどうやるんだろ。
NSString *string = @"1日3食のうち4食はうどんを食べたいと思っている。"; NSRange match = [string rangeOfString:@"[0-9]+食" options:NSRegularExpressionSearch]; if (match.location != NSNotFound) { NSLog(@"Found: %@",[string substringWithRange:match]); } else { NSLog(@"Not Found"); }
下記サイトを参考にしました。
http://blog.livedoor.jp/faulist/archives/1561287.html