Here is a sample code that change the space background colour.
NSMutableAttributedString *mutableString = nil;
//NSString *sampleText = self.lblTest.text;
NSString *sampleText = @"Hi I am Very Good Boy I";
mutableString = [[NSMutableAttributedString alloc] initWithString:sampleText];
NSString *pattern = @" ";
NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:nil];
// enumerate matches
NSRange range = NSMakeRange(0,[sampleText length]);
[expression enumerateMatchesInString:sampleText options:0 range:range usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop)
{
NSRange range = [result rangeAtIndex:0];
// I am using the NSBackgroundColorAttributeName to change the background of space
[mutableString addAttribute:NSBackgroundColorAttributeName value:[UIColor blueColor] range:range];
}];
[self.lblTest setAttributedText:mutableString];