MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Regex

Function Regex

ext/regex.go:104–112  ·  view source on GitHub ↗

Regex returns a cel.EnvOption to configure extended functions for regular expression operations. Note: all functions use the 'regex' namespace. If you are currently using a variable named 'regex', the functions will likely work as intended, however there is some chance for collision. This library

(options ...RegexOptions)

Source from the content-addressed store, hash-verified

102// regex.extractAll('id:123, id:456', 'assa') == []
103// regex.extractAll('testuser@testdomain', '(.*)@([^.]*)') // Runtime Error multiple capture group
104func Regex(options ...RegexOptions) cel.EnvOption {
105 s := &regexLib{
106 version: math.MaxUint32,
107 }
108 for _, o := range options {
109 s = o(s)
110 }
111 return cel.Lib(s)
112}
113
114// RegexOptions declares a functional operator for configuring regex extension.
115type RegexOptions func(*regexLib) *regexLib

Callers 4

TestRegexVersionFunction · 0.85
testRegexEnvFunction · 0.85

Calls 1

LibFunction · 0.92

Tested by 3

TestRegexVersionFunction · 0.68
testRegexEnvFunction · 0.68