Sprig Regex

Sprig Regex #

regexFind #

func regexFind(regex string, str string) string
Returns the first (left most) match of the regular expression in the
input string.

regexFindAll #

func regexFindAll(regex string, str string, n int) []string
Returns a slice of all matches of the regular expression in the input
string.

regexMatch #

func regexMatch(regex string, str string) bool
Returns true if the input string matches the regular expression.

regexQuoteMeta #

func regexQuoteMeta(arg1 string) string
Returns a string that escapes all regular expression meta-characters
inside the argument text; the returned string is a regular expression
matching the literal text

regexReplaceAll #

func regexReplaceAll(regex string, str string, repl string) string
Returns a copy of the input string, replacing matches of the Regexp
with the replacement string replacement. Inside string replacement, $
signs are interpreted as in Expand, so for instance $1 represents the
text of the first sub-match.

regexReplaceAllLiteral #

func regexReplaceAllLiteral(regex string, str string, repl string) string
Returns a copy of the input string, replacing matches of the Regexp
with the replacement string replacement The replacement string is
substituted directly, without using Expand.

regexSplit #

func regexSplit(regex string, str string, n int) []string
Slices the input string into substrings separated by the expression
and returns a slice of the substrings between those expression
matches. The last parameter n determines the number of substrings to
return, where -1 means return all matches.