An edit script contains a list of find and replace operations that, when applied to an original file, produce a modified file.
Since an edit script doesn’t modify the original file directly but allows you to export the result, there’s no risk of replacing many occurrences only to find out later that some replacements didn’t work as intended: you can just correct the edit script and apply it again to the original file.
If you need to replace text in multiple files, just apply the edit script to each file instead of manually repeating the same operations manually in a text editor.
Rules
An edit script consists of a set of rules that are applied sequentially. Each rule finds some text and replaces it with some other text.
The mode of each rule can be set to one of the following values:
- Text: the find and replace values are treated as plain text.
- Regular Expression: use regular expressions to match text patterns that cannot be expressed with plain text. For example, they allow to match numbers or entire words.
Format
An edit script is a JSON file with the following structure:
{
"rules" : [
{
"find" : "apple",
"findMode" : "text",
"replace" : "banana"
}
]
}
findMode
can be text
or regularExpression
.