MCPcopy Create free account
hub / github.com/cel-rust/cel-rust / matches

Function matches

cel/src/functions.rs:278–287  ·  view source on GitHub ↗
(
    ftx: &FunctionContext,
    This(this): This<Arc<String>>,
    regex: Arc<String>,
)

Source from the content-addressed store, hash-verified

276/// ```
277#[cfg(feature = "regex")]
278pub fn matches(
279 ftx: &FunctionContext,
280 This(this): This<Arc<String>>,
281 regex: Arc<String>,
282) -> Result<bool> {
283 match regex::Regex::new(&regex) {
284 Ok(re) => Ok(re.is_match(&this)),
285 Err(err) => Err(ftx.error(format!("'{regex}' not a valid regex:\n{err}"))),
286 }
287}
288
289use crate::common::value::Val;
290#[cfg(feature = "chrono")]

Callers

nothing calls this directly

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected