MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / sub

Function sub

std/re/src/lib.rs:153–155  ·  view source on GitHub ↗
(pattern: String, repl: String, string: String)

Source from the content-addressed store, hash-verified

151 /* sub: replace every match, expanding backreferences in the template. */
152 #[plugin_fn]
153 fn sub(pattern: String, repl: String, string: String) -> Result<String> {
154 rx(main::sub(&pattern, &repl, &string))
155 }
156
157 fn pick(f: &Found, ngroups: usize) -> String {
158 if ngroups == 1 { f.groups[0].clone().unwrap_or_default() } else { f.text.clone() }

Callers

nothing calls this directly

Calls 1

rxFunction · 0.85

Tested by

no test coverage detected