omz/ColorSense-for-Xcode

Updated regex for rgb color with ()

elmyn opened this issue · 1 comments

eg: [UIColor colorWithRed:(153.0/255) green:(153.0/255) blue:153.0/255 alpha:1.0f];

_rgbaUIColorRegex = [[NSRegularExpression regularExpressionWithPattern:@"(\\[\\s*UIColor\\s+colorWith|\\[\\s*\\[\\s*UIColor\\s+alloc\\]\\s*initWith)Red:\\s*\\(?\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\)?\\s+green:\\s*\\(?\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\)?\\s+blue:\\s*\\(?\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\)?\\s*alpha:\\s*\\(?\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\)?\\s*]" options:0 error:NULL] retain];

This part of the pattern: [0-9]f?
Should be changed to [0-9]
[fFdD]?
This is to accommodate styles with upper or lowercase f/d suffixes