diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java index 2727723be7..a75b5a58f6 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java @@ -48,17 +48,17 @@ public class URLValidator extends FieldValidatorSupport { private static final Logger LOG = LogManager.getLogger(URLValidator.class); - public static final String DEFAULT_URL_REGEX = "^(?:https?|ftp)://" + + public static final String DEFAULT_URL_REGEX = "^(?:https?|ftp):\\/\\/" + "(?:(?:[a-z0-9$_.+!*'(),;?&=\\-]|%[0-9a-f]{2})+" + "(?::(?:[a-z0-9$_.+!*'(),;?&=\\-]|%[0-9a-f]{2})+)?" + "@)?#?" + "(?:(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)*" + "[a-z][a-z0-9-]*[a-z0-9]" + "|(?:(?:[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}" + - "[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5]" + + "(?:[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])" + ")(?::\\d+)?" + - ")(?:(?:/(?:[a-z0-9$_.+!*'(),;:@&=\\-]|%[0-9a-f]{2})*)*" + - "(?:\\?(?:[a-z0-9$_.+!*'(),;:@&=\\-/:]|%[0-9a-f]{2})*)?)?" + + ")(?:(?:\\/(?:[a-z0-9$_.+!*'(),;:@&=\\-]|%[0-9a-f]{2})*)*" + + "(?:\\?(?:[a-z0-9$_.+!*'(),;:@&=\\-\\/:]|%[0-9a-f]{2})*)?)?" + "(?:#(?:[a-z0-9$_.+!*'(),;:@&=\\-]|%[0-9a-f]{2})*)?" + "$";