匹配两个符号之间
+ (NSArray *)addObjectArr:(NSString *)text beginFlage:(NSString *)beginFlage endFlag:(NSString *)endFlag { if (!text && !beginFlage && !endFlag) { return nil; } NSString *regex = [NSString stringWithFormat:@"\\%@[a-zA-Z0-9:\\u4e00-\\u9fa5]+\\%@",beginFlage,endFlag]; NSArray *array = [text componentsMatchedByRegex:regex]; return array; }
原文链接:https://www.f2er.com/regex/359518.html