Page 1 of 1

Quick Tip - Restricting to sections of a .INI file

Posted: Thu Sep 09, 2004 10:34 am
by DataMystic Support
You can restrict a replacement or set of changes to a single section of a .INI file. The trick is to use a search/replace as the restriction. The example below converts a .INI file section starting with [TmainForm] to lowercase. This can be easily changed to perform a search/replace, or to remove matching lines, or to add new lines with an Add Footer filter.

Code: Select all

EasyPattern [[ mustBeginWith( '[TmainForm]', cr, lf, ),  1+ char,  mustEndWith( cr, lf, '[' ) ]] with [$0]
|  [ ] Match case
|  [ ] Whole words only
|  [ ] Case sensitive replace
|  [X] Prompt on replace
|  [ ] Skip prompt if identical
|  [ ] First only
|  [ ] Extract matches
|  Maximum text buffer size 4096
|
+--Convert to lowercase
If the .INI file section will be longer than 4Kbytes, increase the maximum text buffer size to suit.