I have a RGB string in the form rgb(34, 34, 34). I want to parse it to a UIColor using iOS. I believe I need a regex for this, but I can't seem to crack it. This is what I have so far.

NSString *regExString = @"(.*?)rgb\((\d+), (\d+), (\d+)\)";

NSError *error = nil;

NSRegularExpression *regEx = [NSRegularExpression regularExpressionWithPattern:regExString
                                                                       options:NSRegularExpressionCaseInsensitive error:&error];

NSArray *matches = [regEx matchesInString:backgroundColorString options:NSRegularExpressionCaseInsensitive
                                        range:NSMakeRange(0, backgroundColorString.length)];

If anybody could send me in the right direction, that would be great.

Edit
Report