func IsStringMatching()

in isdef/string.go [52:69]


func IsStringMatching(regexp *regexp.Regexp) IsDef {
	return Is("is string matching regexp", func(path llpath.Path, v interface{}) *llresult.Results {
		strV, errorResults := isStrCheck(path, v)
		if errorResults != nil {
			return errorResults
		}

		if !regexp.MatchString(strV) {
			return llresult.SimpleResult(
				path,
				false,
				fmt.Sprintf("String '%s' did not match regexp %s", strV, regexp.String()),
			)
		}

		return llresult.ValidResult(path)
	})
}