Upvote:2

Aprove answer
// Create your expression
NSError *error = nil;
NSRegularExpression *regex = 
  [NSRegularExpression regularExpressionWithPattern:@"\\b\f[0-9]*\\b"
                                            options:NSRegularExpressionCaseInsensitive
                                              error:&error];

// Replace the matches
NSString *modifiedString = [regex stringByReplacingMatchesInString:string
                                                       options:0
                                                         range:NSMakeRange(0, [string length])
                                                  withTemplate:@"replacement string"];

Credit Goes to: stackoverflow.com

Related question with same questions but different answers