Small changes
This commit is contained in:
@@ -23,3 +23,16 @@ func IsValidUrl(s string) bool {
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
func IsValidShortUrl(s string) bool {
|
||||
if len(s) < 3 || len(s) > 10 {
|
||||
return false
|
||||
}
|
||||
shortUrlRegex := `^[a-zA-Z0-9]+$`
|
||||
matched, err := regexp.MatchString(shortUrlRegex, s)
|
||||
if err != nil || !matched {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user