常用正则表达式
NSString urlStr = @”jwfwfwfwf@163.com”;
NSError error;
NSRegularExpression reg = [NSRegularExpression regularExpressionWithPattern:@”jwfwfwfwf@163.com” options:0 error:&error];
NSTextCheckingResult firstMatch = [reg firstMatchInString:urlStr options:0 range:NSMakeRange(0, [urlStr length])];
NSRange resultRange = [firstMatch rangeAtIndex:0];
NSString *result = [urlStr substringWithRange:resultRange];
NSLog(@”%@”, result);
1 | 匹配中文字符的正则表达式: [\u4e00-\u9fa5] |