Compare commits
2 Commits
e3e9f81f33
...
97e07db838
| Author | SHA1 | Date | |
|---|---|---|---|
| 97e07db838 | |||
| b070950ed6 |
@ -76,6 +76,15 @@ public class Regex {
|
||||
/** 护照 */
|
||||
public static final String PASSPORT = "^[a-zA-Z0-9]{5,17}$";
|
||||
|
||||
// IPv4 正则表达式
|
||||
public static final String IPv4 = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
|
||||
|
||||
// IPv6 正则表达式(简化版)
|
||||
public static final String IPv6 = "^([0-9a-fA-F]{0,4}:){7}[0-9a-fA-F]{0,4}$|^::1$|^::$|^([0-9a-fA-F]{0,4}:){1,7}:$";
|
||||
|
||||
// 域名正则表达式(RFC 1123)
|
||||
public static final String DOMAIN = "^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)*[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?$";
|
||||
|
||||
public static boolean isMatch(String regex, String text) {
|
||||
if (TimiJava.isEmpty(regex) || TimiJava.isEmpty(text)) {
|
||||
return false;
|
||||
|
||||
@ -390,4 +390,14 @@ public class Text {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取驼峰类名
|
||||
*
|
||||
* @param clazz 类
|
||||
* @return 驼峰类名
|
||||
*/
|
||||
public static String camelCaseClassName(Class<?> clazz) {
|
||||
return Character.toLowerCase(clazz.getSimpleName().charAt(0)) + clazz.getSimpleName().substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user