Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated regex for rgb color with () #26

Open
elmyn opened this issue Mar 5, 2014 · 1 comment
Open

Updated regex for rgb color with () #26

elmyn opened this issue Mar 5, 2014 · 1 comment

Comments

@elmyn
Copy link

elmyn commented Mar 5, 2014

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];
@teamice
Copy link

teamice commented Apr 27, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants