MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / RegisterRegexFunctions

Function RegisterRegexFunctions

extensions/regex_functions.cc:152–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152absl::Status RegisterRegexFunctions(FunctionRegistry& registry,
153 int max_regex_program_size) {
154 // Register Regex Extract Function
155 CEL_RETURN_IF_ERROR(
156 (TernaryFunctionAdapter<
157 absl::StatusOr<Value>, StringValue, StringValue,
158 StringValue>::RegisterGlobalOverload(kRegexExtract,
159 absl::bind_front(
160 &ExtractString,
161 max_regex_program_size),
162 registry)));
163
164 // Register Regex Captures Function
165 CEL_RETURN_IF_ERROR(
166 (BinaryFunctionAdapter<absl::StatusOr<Value>, StringValue, StringValue>::
167 RegisterGlobalOverload(
168 kRegexCapture,
169 absl::bind_front(&CaptureString, max_regex_program_size),
170 registry)));
171
172 // Register Regex CaptureN Function
173 CEL_RETURN_IF_ERROR(
174 (BinaryFunctionAdapter<absl::StatusOr<Value>, StringValue, StringValue>::
175 RegisterGlobalOverload(
176 kRegexCaptureN,
177 absl::bind_front(&CaptureStringN, max_regex_program_size),
178 registry)));
179 return absl::OkStatus();
180}
181
182const Type& CaptureNMapType() {
183 static absl::NoDestructor<Type> kInstance(

Callers 2

SetUpMethod · 0.70
RegisterBuiltinFunctionsFunction · 0.50

Calls 1

ConvertToRuntimeOptionsFunction · 0.85

Tested by 1

SetUpMethod · 0.56