//根据正则表达式过滤非法的字符串
+ (NSString *)filterCharactor:(NSString *)str withRegexString:(NSString *)regexStr
{
NSError * error = nil;
NSRegularExpression * expression = [NSRegularExpression regularExpressionWithPattern:regexStr options:NSRegularExpressionCaseInsensitive error:&error];
NSString * last=[expression stringByReplacingMatchesInString:str options:NSMatchingReportCompletion range:NSMakeRange(0, str.length) withTemplate:@""];
return last;
}
时间: 2024-10-12 15:55:10