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

Function Regex

ext/regex.go:102–110  ·  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

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

Callers 11

optionalCostEnvFunction · 0.92
TestRegexCostBoundsFunction · 0.92
TestOptionalCostBoundsFunction · 0.92
initExtFactoriesFunction · 0.85
TestRegexVersionFunction · 0.85
testRegexEnvFunction · 0.85

Calls 1

LibFunction · 0.92

Tested by 10

optionalCostEnvFunction · 0.74
TestRegexCostBoundsFunction · 0.74
TestOptionalCostBoundsFunction · 0.74
TestRegexVersionFunction · 0.68
testRegexEnvFunction · 0.68