fuint-application/application-service/src/main/java/com/fuint/application/util/RegexUtil.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.fuint.application.util;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * RegexUtil 工具类
 * Created by FSQ
 * Contact wx fsq_better
 * Site https://www.fuint.cn
 */
public class RegexUtil {

    private static final Map<String, Pattern> patternMap = new HashMap();

    public RegexUtil() {
    }

    public static boolean isEmail(String email) {
        String regex = "^\\w+([-+.]+\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
        return matches(email, regex);
    }

    public static boolean isMobile(String mobile) {
        String regex = "^1\\d{10}$";
        return matches(mobile, regex);
    }

    public static boolean isPhone(String phone) {
        String regex = "^((\\(\\d{2,3}\\))|(\\d{3}\\-))?(\\(0\\d{2,3}\\)|0\\d{2,3}-)?[1-9]\\d{6,7}(\\-\\d{1,4})?$";
        return matches(phone, regex);
    }

    public static boolean isChinese(String str) {
        String regex = "^[\\u4e00-\\u9fa5]+$";
        return matches(str, regex);
    }

    public static boolean isEnglish(String str) {
        return matches(str, "^[A-Za-z]+$");
    }

    public static boolean isNumber(String str) {
        return matches(str, "^\\d+$");
    }

    public static boolean isAmount(String str) {
        String regex = "^(0|[1-9]\\d*)$|^(0|[1-9]\\d*)\\.(\\d{1,2})$";
        return matches(str, regex);
    }

    public static boolean isDate(String date) {
        String regex = "^(\\d{4})-(0\\d{1}|1[0-2])-(0\\d{1}|[12]\\d{1}|3[01])$";
        return matches(date, regex);
    }

    public static boolean isTime(String time) {
        String regex = "^(0\\d{1}|1\\d{1}|2[0-3]):[0-5]\\d{1}:([0-5]\\d{1})$";
后面还有 30 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。