Xcode之正则表达式搜索替换提取所需字符串

在Xcode编辑器中 command + F 组合键打开搜索替换框:
(RGBA为项目中自定义的宏)

search:
\[UIColor colorWithRed:(\d+)/255\.0 green:.(\d+)/255.0 blue:(\d+)/255\.0 alpha:(\d+)\]

replace:
RGBA($1, $2, $3, $4)


    //
    _shopNameLabel = [[UILabel alloc] init];
    _shopNameLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
    _shopNameLabel.textColor = [UIColor colorWithRed:49/255.0 green:49/255.0 blue:49/255.0 alpha:1];
    [_backView addSubview:_shopNameLabel];
    
    //
    _shopDesciptionLabel = [[UILabel alloc] init];
    _shopDesciptionLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:13];
    _shopDesciptionLabel.textColor = [UIColor colorWithRed:49/255.0 green:49/255.0 blue:49/255.0 alpha:1];
    [_backView addSubview:_shopDesciptionLabel];



    //
    _shopNameLabel = [[UILabel alloc] init];
    _shopNameLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
    _shopNameLabel.textColor = [UIColor colorWithRed:49/255.0 green:49/255.0 blue:49/255.0 alpha:1];
    [_backView addSubview:_shopNameLabel];
    
    //
    _shopDesciptionLabel = [[UILabel alloc] init];
    _shopDesciptionLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:13];
    _shopDesciptionLabel.textColor = [UIColor colorWithRed:49/255.0 green:49/255.0 blue:49/255.0 alpha:1];
    [_backView addSubview:_shopDesciptionLabel];

你可能感兴趣的:(Xcode之正则表达式搜索替换提取所需字符串)