Skip to content
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

Merged
merged 3 commits into from
Aug 7, 2017
Merged

Append new validations hostname and fqdn #298

merged 3 commits into from
Aug 7, 2017

Conversation

senuphtyz
Copy link
Contributor

Fixes Or Enhances # .

Make sure that you've checked the boxes below before you submit PR:

  • Tests exist or have been written that cover this particular change.

Change Details:

added hostname & fqdn validations

@go-playground/admins

added hostname & fqdn validations

Copy link
Contributor

@deankarn deankarn left a 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
Copy link
Contributor

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 stringato 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])$`
Copy link
Contributor

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
@senuphtyz
Copy link
Contributor Author

senuphtyz commented Aug 5, 2017

That validator is a great help and great work of you.
Code hygiene is very important also to me so i changed code according to your review.

@deankarn deankarn merged commit d529ee1 into go-playground:v9 Aug 7, 2017
fairyhunter13 added a commit to fairyhunter13/validator that referenced this pull request Jul 12, 2020
Append new validations hostname and fqdn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants