struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts git commit: Uses better RegEx to improve performance
Date Tue, 01 Aug 2017 10:06:59 GMT
Repository: struts
Updated Branches:
  refs/heads/support-2-3 54a4dce7b -> 744c1f409


Uses better RegEx to improve performance


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/744c1f40
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/744c1f40
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/744c1f40

Branch: refs/heads/support-2-3
Commit: 744c1f409d983641af3e8e3b573c2f2d2c2c6d9c
Parents: 54a4dce
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Tue Aug 1 12:01:43 2017 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Tue Aug 1 12:01:43 2017 +0200

----------------------------------------------------------------------
 .../xwork2/validator/validators/URLValidator.java         | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/744c1f40/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
index 9aa3c9d..b46dea3 100644
--- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
+++ b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
@@ -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})*)?" +
                     "$";
         }
     }


Mime
View raw message