package com.shucha.digitalportalbackstage.biz.utils;
import org.springframework.stereotype.Component;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Component
public class RegexPhoneUtil {
private static String REGEX_PHONE = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\d{8}$";
public Boolean regexPhone(String phone){
Boolean b;
if(phone.length() != 11){
b = false;
}else{
Pattern p = Pattern.compile(REGEX_PHONE);
Matcher m = p.matcher(phone);
boolean isMatch = m.matches();
if(isMatch){
b = true;
} else {
b = false;
}
}
return b;
}
}