package com.hdkj.fhzg.constant;

import java.util.regex.Pattern;

/**
 * @Description: 正则表达式常量类
 * @Author: wenhao
 * @Create: 2022/10/18 11:04
 * @Version: 1.0
 */
public final class RegexPatternConstant {

    public final static String BASIC_REGEX = "^[\\u4E00-\\u9FA5A-Za-z0-9_]+$"; //只允许中文、英文、数字包括下划线

    public final static String EMAIL_REGEX = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"; //Email地址

    public final static String URL_REGEX = "[a-zA-z]+://[^\\s]*"; //URL格式

    public final static String MOBILE_PHONE_REGEX = "^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\\d{8}$"; //移动电话

    public final static String FIX_PHONE_REGEX = "\\d{3}-\\d{8}|\\d{4}-\\d{7}"; //固定电话

    public final static String IDENTITY_REGEX = "(^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}[0-9Xx]$)|(^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$)"; //身份证格式

    public final static String NORM_DATE_REGEX = "^\\d{4}-\\d{1,2}-\\d{1,2}"; //日期（年月日）格式

    public final static String NORM_TIME_REGEX = "^\\d{1,2}:\\d{1,2}:\\d{1,2}"; //时间（时分秒）格式

    public final static String NORM_DATETIME_REGEX = "^\\d{4}-\\d{1,2}-\\d{1,2}\\s\\d{1,2}:\\d{1,2}:\\d{1,2}"; //日期（年月日时分秒）格式

    public final static String ACCOUNT_REGEX = "^[a-zA-Z][a-zA-Z0-9_]{4,15}$"; //账号必须以字母开头，允许5-16字节，允许字母数字下划线

    public final static String CIPHER_REGEX = "^(?=.*\\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,16}$"; //密码必须包含字母、数字和特殊字符的组合，长度在8-16之间

    public final static String CHINESE_REGEX = "[\\u4e00-\\u9fa5]+"; //中文内容格式

    public final static String DOUBLE_BYTE_REGEX = "[^\\x00-\\xff]{0,}$"; //双字节内容格式

    public final static String ZIP_CODE_REGEX = "[1-9]\\d{5}(?!\\d)"; //邮政编码格式

    public final static String IP_ADDRESS_REGEX = "\\d+\\.\\d+\\.\\d+\\.\\d+"; //IP地址格式

    public final static String NONZERO_NUMBER_REGEX = "^[1-9]\\d{0,}$"; //非零数字格式

    public final static String NORM_YEAR_REGEX = "^\\d{4}"; //日期（年）格式

    public final static String NUM_FLOAT_REGEX = "^(100|[1-9]?\\d(\\.\\d\\d?\\d?)?)$"; //纯数字且包含小数点

    public final static String MONEY_ALL_REGEX = "^([0-9]|([1-9][0-9]{0,9}))(\\.[0-9]{1,6})?$"; //金额，整数不超过10位，小数不超过6位，包含0

    public final static String MONEY_REGEX = "^(([1-9][0-9]{0,9}(\\.[0-9]{1,6})?)|(0\\.[0-9]{1,6}))$"; //金额，整数不超过10位，小数不超过6位，大于0

    public final static String KH_REGEX = "\\((.*?)\\)|\\（(.*?)\\）"; //括号（中英文）

    public final static String BIRTHDAY_REGEX = "^((?:19[2-9]\\d{1})|(?:20(?:(?:0[0-9])|(?:1[0-8]))))((?:0?[1-9])|(?:1[0-2]))((?:0?[1-9])|(?:[1-2][0-9])|30|31)$"; //出生日期

    public final static String BATCH_NO_REGEX = "(?:\\(|（)?([A-Z0-9]{2}\\d{2}[A-Z0-9]{2})(?:\\)|）)?";//校验批次号，第3、4位可获取到年份

    public final static String SCHEMA_GROUP_NAME_REGEX = "[（(].*?[）)]";

    public final static String BIDNUM_WITH_PACK_REGEX = "分标编号[:：]?\\s*(\\d+[-\\d]*)\\s*";

    public final static String GROUP_NAME_INFO_REGEX = "^[^，,]+";

    public static final Pattern CONTAINS_NUMBER = Pattern.compile(".*\\d+.*"); //字符串是否包含数字

    public static final Pattern CONTAINS_NUMBER_SIGNED = Pattern.compile("[+-]?\\d+(?:\\.\\d+)?"); //字符串是否包含正负号的数字

    public static final Pattern INTEGER_RANGE = Pattern.compile("^\\[\\d+,\\d+\\]$"); //整数范围

    public static final Pattern DECIMAL_RANGE = Pattern.compile("^\\[\\d+,\\d+\\]\\.\\d+$"); //小数范围

    // 1.检测首尾的长数字串（长度>=4），截取保留中文部分重新再查一次
    public static final Pattern BOUNDARY_DIGITS = Pattern.compile("^\\d{4,}.*|.*\\d{4,}$");

    public static final Pattern AHEAD_NUMBER = Pattern.compile("\\d+(?:\\.\\d+)?(?=\\[|\\()");

    public static final Pattern CONTAINS_BATCH_NO = Pattern.compile("\\d+");

    public static final Pattern TECHNICAL_GROUP_NAME_PATTERN = Pattern.compile(".*技术(一|二|三|四|五|六|七|八|九|十)组.*");

    public static final Pattern BUSINESS_GROUP_NAME_PATTERN = Pattern.compile(".*商务(一|二|三|四|五|六|七|八|九|十)组.*");

    public final static String BATCH_WITH_BID_NUMBER_REGEX = "^([A-Z0-9]+)-";

    public final static String EXPERT_GROUP_NAME_REGEX = "^(技术|商务)([一二三四五六七八九十百千万零]{1,})组";

}
