mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
Uses better RegEx to improve performance
This commit is contained in:
+5
-5
@@ -74,18 +74,18 @@ public class URLValidator extends FieldValidatorSupport {
|
||||
return urlRegex;
|
||||
} else {
|
||||
return "^(https?|ftp):\\/\\/" +
|
||||
"(([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]\\.|[a-z0-9][a-z0-9-]*[a-z0-9]\\.)*" +
|
||||
"[a-z][a-z0-9-]*[a-z0-9]" +
|
||||
"|((\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\.){3}" +
|
||||
"(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])" +
|
||||
")(:\\d+)?" +
|
||||
")(((\\/{0,1}([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})*)?" +
|
||||
"(#([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=\\-]|%[0-9a-f]{2})*)?" +
|
||||
"$";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user