//
//  RegexUtil.m
//  XFFruit
//
//  Created by 陈俊俊 on 15/9/9.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "RegexUtil.h"

@implementation RegexUtil

+ (BOOL)isValidateNmuberAndFloat:(NSString *)candidate{
    NSString *regStr=@"(^[0-9]+(\\.[0-9]+)?$)";
    NSPredicate *numberTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regStr];
    
    return [numberTest evaluateWithObject:candidate];
}

+ (BOOL)isValidatePhone:(NSString *) candidate {
    //    NSString *phoneRegex = @"(13[0-9]|15[0|3|6|7|8|9]|18[2|3|6|7|8|9])\\d{8}";
    NSString *phoneRegex=@"(\\d{11,11})";
    NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
    
    return [phoneTest evaluateWithObject:candidate];
}

// 手机号前3位规定
+ (BOOL)isValidatePhoneNew:(NSString *)candidate {
    // NSString *phoneRegex = @"(13[0-9]|15[0|3|6|7|8|9]|18[2|3|6|7|8|9])\\d{8}";
    NSString *phoneRegex = @"(13[0-9]|14[0-9]|15[0-9]|18[0-9]|17[0|6|7|8])\\d{8}";
    NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
    
    return [phoneTest evaluateWithObject:candidate];
}




@end
