package me.qwq.doghouse.constants;

import java.util.regex.Pattern;

public class UsefulRegex {
    
    public static final String IGNORE_CASE = "(?i)";
    
    public static final String BLANK = "^\\s*$";
    
    public static final String OR = "|";

    public static final String DOMAIN = "^(https?://)?([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$";
    
    public static final String DOMAIN_WITHOUT_SCHEME = "^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$";
    
    public static final String URL = "^((https?:)?//)?([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}(/.*?)?$";
    
    public static final String URL_WITH_SCHEME = "^https?://([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}(/.*?)?$";
    
    public static final String URL_ENDS_WITH_SLASH = "^((https?:)?//)?([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}(/.*?)?/$";
    
    public static final String EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";

    public static final String IPv4 = "^((?:(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)))\\.){3}(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d))))$";
    
    public static final String IPv4_WITH_WILECARD = "^((?:(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)|\\*))\\.){3}(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)|\\*)))$";
    
    public static final String ANY_CHINESE = ".*?[\\u4E00-\\u9FA5]+.*?";

    public static final Pattern ANY_CHINESE_PATTERN = Pattern.compile(UsefulRegex.ANY_CHINESE, Pattern.DOTALL);
    
    public static final Pattern ADMIN_PATTERN = Pattern.compile("^[/\\\\]*admin[/\\\\]+(?<version>v\\d+)[/\\\\]*(?<action>.*?)$");

}
