NSString *parten = @"#([^\\#]+)#";
NSError* error = NULL;
NSRegularExpression* regex = [[NSRegularExpression alloc]
initWithPattern:parten
options:NSRegularExpressionCaseInsensitive|NSRegularExpressionDotMatchesLineSeparators
error:&error]; //2
NSArray* chunks = [regex matchesInString:markup options:0
range:NSMakeRange(0, [markup length])];
[regex release];
NSMutableArray *colorRangeArray = [[NSMutableArray alloc] init];
for (NSTextCheckingResult* matc in chunks)
{
NSRange range = [matc range];
[colorRangeArray addObject:NSStringFromRange(range)];
NSRange subrange = NSMakeRange(range.location+1, range.length-2);
NSString *rangeSubStr = [markup substringWithRange:subrange];
NSLog(@"rangeSubStr=:%@",rangeSubStr);
}