Skip to content

Commit

Permalink
fix url pattern or clear todo.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlasosik committed Apr 21, 2024
1 parent 56ea377 commit cfb06af
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/

public class UrlLongFormatValidatorImpl implements ConstraintValidator<UrlLongFormatValidator, String> {
private static final Pattern URL_PATTERN = Pattern
.compile("https?://\\w+\\.\\w+\\.(?:[a-zA-Z]{2,4})(?:/.*)?");// TODO: needs to be redone!
private static final Pattern URL_REGEX = Pattern
.compile("https?://[\\w.-]+\\.(?:[a-zA-Z]{2,4})(?:/.*)?");
/**
* Checks if the entered string matches the URL format.
*
Expand Down Expand Up @@ -55,7 +55,7 @@ public boolean isValid(String url, ConstraintValidatorContext context) {
* @return true if the URL string matches the standard URL format, false otherwise.
*/
private static boolean validateUrl(String url) {
return url.matches(URL_PATTERN.pattern());
return url.matches(URL_REGEX.pattern());
}

/**
Expand Down

0 comments on commit cfb06af

Please sign in to comment.