MCPcopy Create free account
hub / github.com/davidblewett/rure-python / replace

Method replace

regex/src/re_unicode.rs:509–515  ·  view source on GitHub ↗

Replaces the leftmost-first match with the replacement provided. The replacement can be a regular string (where `$N` and `$name` are expanded to match capture groups) or a function that takes the matches' `Captures` and returns the replaced string. If no match is found, then a copy of the string is returned unchanged. # Replacement string syntax All instances of `$name` in the replacement text

(
        &self,
        text: &'t str,
        rep: R,
    )

Source from the content-addressed store, hash-verified

507 /// # }
508 /// ```
509 pub fn replace<'t, R: Replacer>(
510 &self,
511 text: &'t str,
512 rep: R,
513 ) -> Cow<'t, str> {
514 self.replacen(text, 1, rep)
515 }
516
517 /// Replaces all non-overlapping matches in `text` with the replacement
518 /// provided. This is the same as calling `replacen` with `limit` set to

Callers

nothing calls this directly

Calls 1

replacenMethod · 0.45

Tested by

no test coverage detected