This commit is contained in:
unknown
2026-02-04 20:27:13 +08:00
commit 3b042d1dad
9410 changed files with 1488147 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package regexputils
import "regexp"
var (
YYYYMMDDHH = regexp.MustCompile(`^\d{10}$`)
YYYYMMDD = regexp.MustCompile(`^\d{8}$`)
YYYYMM = regexp.MustCompile(`^\d{6}$`)
)
var (
HTTPProtocol = regexp.MustCompile("^(?i)(http|https)://")
)

View File

@@ -0,0 +1,19 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package regexputils_test
import (
"github.com/TeaOSLab/EdgeAPI/internal/utils/regexputils"
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestExpr(t *testing.T) {
var a = assert.NewAssertion(t)
a.IsTrue(regexputils.YYYYMMDD.MatchString("20221011"))
a.IsFalse(regexputils.YYYYMMDD.MatchString("202210"))
a.IsTrue(regexputils.YYYYMM.MatchString("202210"))
a.IsFalse(regexputils.YYYYMM.MatchString("20221011"))
}