mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-08 12:57:13 +08:00
fix: 正则表达式问题
This commit is contained in:
@@ -70,11 +70,20 @@ public class RegexConstants {
|
||||
* 域名、IPV4、IPV6
|
||||
* </p>
|
||||
*/
|
||||
public static final String HTTP_HOST = """
|
||||
^((?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|
|
||||
(?:(?: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]?)|
|
||||
(?:(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|
|
||||
""";
|
||||
public static final String HTTP_HOST =
|
||||
"^(" +
|
||||
// ① 域名
|
||||
"(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z]{2,63}" +
|
||||
"|" +
|
||||
// ② IPv4
|
||||
"(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)" +
|
||||
"|" +
|
||||
// ③ IPv6(8 组 1-4 位十六进制,用 : 分隔,支持压缩 0)
|
||||
"(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}" +
|
||||
"|" +
|
||||
// ④ IPv6 压缩形式(::)
|
||||
"(?:[0-9A-Fa-f]{1,4}:){0,6}::(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4}" +
|
||||
")$";
|
||||
|
||||
private RegexConstants() {
|
||||
}
|
||||
|
Reference in New Issue
Block a user