MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / IsMatchString

Function IsMatchString

common/regexp.go:56–71  ·  view source on GitHub ↗
(regexpPattern RegexpPattern, s string)

Source from the content-addressed store, hash-verified

54)
55
56func IsMatchString(regexpPattern RegexpPattern, s string) error {
57 b, _ := regexp.MatchString(string(regexpPattern), s)
58 if b {
59 return nil
60 }
61 switch regexpPattern {
62 case EnglishOrNumber_:
63 return errors.New("只能使用英文字母、数字、下划线,英文字母开头")
64 case AnyEnglishOrNumber_:
65 return errors.New("只能使用英文字母、数字、下划线")
66 case UUIDExp:
67 return errors.New("只能使用英文字母、数字、横杠、下划线")
68 default:
69 return errors.New("非法字符串")
70 }
71}
72
73// IsMatchVariable 判断字符串是否匹配环境变量标准格式${abc}
74func IsMatchVariable(s string) bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected