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)
| 100 | // regex.extractAll('id:123, id:456', 'assa') == [] |
| 101 | // regex.extractAll('testuser@testdomain', '(.*)@([^.]*)') // Runtime Error multiple capture group |
| 102 | func Regex(options ...RegexOptions) cel.EnvOption { |
| 103 | s := ®exLib{ |
| 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. |
| 113 | type RegexOptions func(*regexLib) *regexLib |