INI-file editing example

Let's edit an INI-file: insert one key after some predefined text in a section and save the file with the new name.

This is the original file:
The original file

Then we add several edit rules:

1. Find regular expression "\[item\].*m2v":
Edit rule to find the text in a section
The "\[item\]" string means section name "item" enclosed in the square brackets.
We also use the regular expression ".*" notation here which means "any number of any symbols".

See also the Regular Expressions Syntax.

2. Compose the new text to replace the one we found on the first step:
Edit rule to compose the replacement text
It is named "new item text" and created from the format using the existing text piece: a new line symbol and one string are appended to the text.

See also the Format String Syntax.

3. Replace text in file found on the first step with the text piece we have created:

5. Now let's prepare the new file name where the file will be saved. First obtain the current file name:
Edit rule to obtain the current file name

4. Then compose the new file name from the format string using the current path name and extension:
Edit rule to compose the new file name

6. Finally, save the file with the name that we have created:
Edit rule to save file

Now the the Edit Rules window contains seven rules:

Now let's start the program.
Click the "Step" button and the first rule will be executed.
The text found in the file is now shown on the Data View window and you can highlight it by double clicking the data piece:
Text found in file

Click the "Pass" button to execute all rules and examine the Data View:
Text got replaced and file saved
You can see that the new file name was created and file saved.

After pressing "Reset" we finish executing edit rules and all data pieces disappear.

You can download the files: the original file, edit rules (save it and click "Load edit rules" in the Edit Rules window) and the edited file.