package parser import "regexp" func doCheck(pattern string, arg string) (bool, error){ match, err := regexp.MatchString(pattern, arg) if err != nil { return false, err } if match { return true, nil } else { return false, nil } } func isFlag(arg string) (bool, error) { return doCheck(flagRegex, arg) } func isInt(arg string) (bool, error) { return doCheck(intRegex, arg) } func isFloat(arg string) (bool, error) { return doCheck(floatRegex, arg) }