search_and_replace¶
Operation for searching for text and replacing it with new text.
Example¶
The following example uses the search_and_replace operation to replace the greeting
in the basic-hello-world.yml example:
examples/operations/search_and_replace.yml¶steps:
"Replace greeting in basic-hello-world example":
name: search_and_replace
file_path: "examples/basic-hello-world.yml"
search: "Hello"
replace: "Hola"
Running this operation replaces “Hello” with “Hola” within the file.
Required context¶
file_pathPath to file relative to the current working directory.
searchText to search for in file.
replaceText used to replace text matching
search.
Optional context¶
use_regexdefault:
FalseUse
re.subinstead ofstr.replace.