Function replacement_if_match

Source
pub fn replacement_if_match(
    line: &str,
    search: &SearchType,
    replace: &str,
) -> Option<String>
Expand description

Performs a search and replace operation on a string if the pattern matches

§Arguments

  • line - The string to search within
  • search - The search pattern (fixed string, regex, or advanced regex)
  • replace - The replacement string

§Returns

  • Some(String) containing the string with replacements if matches were found
  • None if no matches were found