ghttp路由功能改进

This commit is contained in:
John
2018-04-11 12:05:25 +08:00
parent 213e0e25f1
commit e4656cdc51
6 changed files with 136 additions and 35 deletions

View File

@ -11,6 +11,12 @@ import (
"regexp"
)
// 校验所给定的正则表达式是否符合规范
func Validate(pattern string) error {
_, err := regexp.Compile(pattern)
return err
}
// 正则表达式是否匹配
func IsMatch(pattern string, src []byte) bool {
match, err := regexp.Match(pattern, src)