Files
EdgeCommon/pkg/serverconfigs/shared/regexp.go
2023-08-08 15:12:28 +08:00

14 lines
630 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package shared
import "regexp"
// 常用的正则表达式
var (
RegexpDigitNumber = regexp.MustCompile(`^\d+$`) // 正整数
RegexpFloatNumber = regexp.MustCompile(`^\d+(\.\d+)?$`) // 正浮点数不支持e
RegexpAllDigitNumber = regexp.MustCompile(`^[+-]?\d+$`) // 整数,支持正负数
RegexpAllFloatNumber = regexp.MustCompile(`^[+-]?\d+(\.\d+)?$`) // 浮点数支持正负数不支持e
RegexpExternalURL = regexp.MustCompile("(?i)^(http|https|ftp)://") // URL
RegexpNamedVariable = regexp.MustCompile(`\${[\w.-]+}`) // 命名变量
)