新增路径判断方法

This commit is contained in:
wanggeng888 2021-04-25 21:49:53 +08:00
parent e52a7f25c4
commit 2f4b2ea77a

View File

@ -36,9 +36,13 @@ public class RegexUtil {
*/ */
private static final Pattern PATTERN_EMAIL = Pattern.compile("^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$"); private static final Pattern PATTERN_EMAIL = Pattern.compile("^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$");
/** /**
* 邮箱 * URL
*/ */
private static final Pattern PATTERN_URL = Pattern.compile("(^#)|(^http(s*):\\/\\/[^\\s]+)"); private static final Pattern PATTERN_URL = Pattern.compile("(^#)|(^http(s*):\\/\\/[^\\s]+)");
/**
* 路径
*/
private static final Pattern PATTERN_PATH = Pattern.compile("\\/[^\\s]*");
/** /**
* 日期格式 * 日期格式
*/ */
@ -164,6 +168,16 @@ public class RegexUtil {
return PATTERN_URL.matcher(input).matches(); return PATTERN_URL.matcher(input).matches();
} }
/**
* 判断PATH
*
* @param input
* @return
*/
public static boolean isPath(String input) {
return PATTERN_PATH.matcher(input).matches();
}
/** /**
* 判断日期 * 判断日期
* *
@ -311,8 +325,4 @@ public class RegexUtil {
return path; return path;
} }
public static void main(String[] args) {
System.out.println(isHhMmSs("1111111"));
}
} }