mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-21 21:33:22 +01:00
16 lines
265 B
Go
16 lines
265 B
Go
package utl
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
// MatchString reports whether a string s
|
|
// contains any match of a regular expression.
|
|
func MatchString(exp string, s string) bool {
|
|
re, err := regexp.Compile(exp)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
return re.MatchString(s)
|
|
}
|