Skip to content

Commit

Permalink
further fixed faulty RegEx: missing grouping for last number in ip-ad…
Browse files Browse the repository at this point in the history
…dress and escaped '/' to work in javascript
  • Loading branch information
sdutry committed Aug 3, 2017
1 parent 8a04e80 commit 418a20c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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})*)?" +
"$";

Expand Down

0 comments on commit 418a20c

Please sign in to comment.