From 739490c62b65c902a09b9009217972628858e724 Mon Sep 17 00:00:00 2001 From: huangqian Date: Wed, 22 Dec 2021 20:23:24 +0800 Subject: [PATCH] revert file --- text/gregex/gregex.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/text/gregex/gregex.go b/text/gregex/gregex.go index 105d153c8..a1dfc9686 100644 --- a/text/gregex/gregex.go +++ b/text/gregex/gregex.go @@ -138,3 +138,12 @@ func ReplaceStringFuncMatch(pattern string, src string, replaceFunc func(match [ return "", err } } + +// Split slices `src` into substrings separated by the expression and returns a slice of +// the substrings between those expression matches. +func Split(pattern string, src string) []string { + if r, err := getRegexp(pattern); err == nil { + return r.Split(src, -1) + } + return nil +}