pub fn replace_all_in_file(
file_path: &Path,
search: &SearchType,
replace: &str,
multiline: bool,
) -> Result<bool>Expand description
Performs search and replace operations in a file
When multiline is enabled: reads the entire file into memory and performs replacements spanning multiple lines. When multiline is disabled: reads line-by-line and performs replacements within lines.
§Arguments
file_path- Path to the file to processsearch- The search pattern (fixed string, regex, or advanced regex)replace- The replacement stringmultiline- Whether to enable multiline replacement (whole-text matching)
§Returns
Ok(true)if replacements were made in the fileOk(false)if no replacements were made (no matches found)Errif any errors occurred during the operation