-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Append new validations hostname and fqdn #298
Conversation
- hostname - fqdn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than those tow minor things LGTM
Finally another person adding some validations 👍
doc.go
Outdated
@@ -794,6 +794,18 @@ Note: See Go's ParseMAC for accepted formats and types: | |||
|
|||
http://golang.org/src/net/mac.go?s=866:918#L29 | |||
|
|||
Hostname | |||
|
|||
This validates that a stringa value is a valid Hostname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor but if can change stringa
to string
regexes.go
Outdated
@@ -30,6 +30,7 @@ const ( | |||
latitudeRegexString = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$" | |||
longitudeRegexString = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$" | |||
sSNRegexString = `^\d{3}[- ]?\d{2}[- ]?\d{4}$` | |||
hostnameRegexString = `^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also minor but if you could make the groups non-capturing that'd be great! eg. (?:
- Minor performance improve for FQDN validation - Fix typo in documentation - Simplified hostname regex
That validator is a great help and great work of you. |
Append new validations hostname and fqdn
Fixes Or Enhances # .
Make sure that you've checked the boxes below before you submit PR:
Change Details:
added hostname & fqdn validations
@go-playground/admins
added hostname & fqdn validations