-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #958 from Juniper/955-validation-regex-malformed
Bug #955: Centralize regexes used in attribute validation
- Loading branch information
Showing
13 changed files
with
55 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package apstraregexp | ||
|
||
import "regexp" | ||
|
||
const ( | ||
alphaNumW2HLConstraintReString = "^[" + alphaNumW2HLConstraintChars + "]+$" | ||
alphaNumW2HLConstraintChars = "a-zA-Z0-9_-" | ||
AlphaNumW2HLConstraintMsg = "value must consist only of the following characters: `" + alphaNumW2HLConstraintChars + "`." | ||
|
||
freeformHostnameConstraintReString = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$" | ||
FreeformHostnameConstraintMsg = "value must match regexp: `" + freeformHostnameConstraintReString + "`." | ||
|
||
hostNameConstraintReString = "^[" + hostNameConstraintChars + "]+$" | ||
hostNameConstraintChars = "a-zA-Z0-9.-" | ||
HostNameConstraintMsg = "value must consist only of the following characters: `" + hostNameConstraintChars + "`." | ||
|
||
stdNameConstraintReString = "^[" + stdNameConstraintChars + "]+$" | ||
stdNameConstraintChars = "a-zA-Z0-9._-" | ||
StdNameConstraintMsg = "value must consist only of the following characters: `" + stdNameConstraintChars + "`." | ||
) | ||
|
||
var ( | ||
AlphaNumW2HLConstraint = regexp.MustCompile(alphaNumW2HLConstraintReString) | ||
FreeformHostnameConstraint = regexp.MustCompile(freeformHostnameConstraintReString) | ||
HostNameConstraint = regexp.MustCompile(hostNameConstraintReString) | ||
StdNameConstraint = regexp.MustCompile(stdNameConstraintReString) | ||
) |