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