Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Update the yamlStyleFloat regex for special case. #241
Conversation
| @@ -81,7 +81,7 @@ func resolvableTag(tag string) bool { | ||
| return false | ||
| } | ||
| -var yamlStyleFloat = regexp.MustCompile(`^[-+]?[0-9]*\.?[0-9]+([eE][-+][0-9]+)?$`) | ||
| +var yamlStyleFloat = regexp.MustCompile(`^[-+]?(0|[1-9][0-9]*)?(\.[0-9]+)?([eE][-+][0-9]+)?$`) |
gabriel-samfira
May 18, 2017
Shouldn't this be:
// the sign of what follows after "[eE]" should be optional.
var yamlStyleFloat = regexp.MustCompile(`^[-+]?(0|[1-9][0-9]*)?(\.[0-9]+)?([eE][-+]?[0-9]+)?$`)to allow:
floats := []string{
"2.2e11",
"2.2e+11", // same as above, but with an explicit sign
"2.2e-11",
}?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
howbazaar commentedFeb 15, 2017
Fixes #157 by updating the regex for float matching.
Instead of allowing mantissa to be any 0-9 sequence, this change means it must be either 0, or not start with a zero.