Replace regex matches in attributed string with image in Objective-C
问题 My goal is to store the information for an attributed string in Parse.com. I decided to come up with an encoding for attributed text for my images that works by replacing any string {X} in braces with the corresponding image. For example: Picture of 2 colorless mana: {X} Should produce an attributed string where {X} is replaced by an image. This is what I've tried: NSString *formattedText = @"This will cost {2}{PW}{PW} to cast."; NSRegularExpression *regex = [NSRegularExpression