Commit 58f5ef30 by Harris Zhang Committed by GitHub

fix regex error

parent 8940dc6c
...@@ -11,8 +11,8 @@ import java.util.regex.Pattern; ...@@ -11,8 +11,8 @@ import java.util.regex.Pattern;
public class InputValidator { public class InputValidator {
public static final String INVALID_CLUSTER_NAMESPACE_MESSAGE = "只允许输入数字,字母和符号 - _ ."; public static final String INVALID_CLUSTER_NAMESPACE_MESSAGE = "只允许输入数字,字母和符号 - _ .";
public static final String INVALID_NAMESPACE_NAMESPACE_MESSAGE = "不允许以.json, .yml, .yaml, .xml, .properties结尾"; public static final String INVALID_NAMESPACE_NAMESPACE_MESSAGE = "不允许以.json, .yml, .yaml, .xml, .properties结尾";
public static final String CLUSTER_NAMESPACE_VALIDATOR = "[0-9a-zA-z_.-]+"; public static final String CLUSTER_NAMESPACE_VALIDATOR = "[0-9a-zA-Z_.-]+";
public static final String APP_NAMESPACE_VALIDATOR = "[a-zA-z0-9._-]+(?<!\\.(json|yml|yaml|xml|properties))$"; public static final String APP_NAMESPACE_VALIDATOR = "[a-zA-Z0-9._-]+(?<!\\.(json|yml|yaml|xml|properties))$";
private static final Pattern CLUSTER_NAMESPACE_PATTERN = private static final Pattern CLUSTER_NAMESPACE_PATTERN =
Pattern.compile(CLUSTER_NAMESPACE_VALIDATOR); Pattern.compile(CLUSTER_NAMESPACE_VALIDATOR);
private static final Pattern APP_NAMESPACE_PATTERN = private static final Pattern APP_NAMESPACE_PATTERN =
...@@ -28,6 +28,6 @@ public class InputValidator { ...@@ -28,6 +28,6 @@ public class InputValidator {
if (StringUtils.isEmpty(name)){ if (StringUtils.isEmpty(name)){
return false; return false;
} }
return CLUSTER_NAMESPACE_PATTERN.matcher(name.toLowerCase()).matches() && APP_NAMESPACE_PATTERN.matcher(name).matches(); return CLUSTER_NAMESPACE_PATTERN.matcher(name).matches() && APP_NAMESPACE_PATTERN.matcher(name).matches();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment