で、いくつUITextBoxfield
かの値を挿入し、文字列に一致する正規表現を使用したい..ボタンを押したときに、テキストボックスのテキストを3桁までの数字のみに一致させる必要があります...私がしようとしているのは動作していません::-
-(IBAction)ButtonPress{
NSString *string =activity.text;
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^[0-9]{1,3}$" options:NSRegularExpressionCaseInsensitive error:&error];
NSString *modifiedString = [regex stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@""];
if ([activity.text isEqualToString:modifiedString ])
{ // work only if this matches numeric value from the text box text
}}