This bug is fixed with UltraEdit for Windows v25.00.0.82. UEStudio v18.00 (any build) doesn't have this bug.
The bug was caused by a change on how strings of the following macro commands must be written in Edit/Create Macro
dialog in multi-line macro code edit field:
There was since beginning of UltraEdit the problem that UltraEdit supported recording macros with multi-line search/replace strings and as well as search/replace strings with one or more double quotes inside. While in binary code of a macro such search/replace strings were never a problem, it was always a problem to compile macro code edited or created in Edit/Create Macro
dialog on a search/replace string containing "
or being a multi-line search/replace string on which one line inside the multi-line string by chance ends with a double quote.
Where does one string containing "
and/or spanning over multiple lines and containing a line ending with "
really end and where does the next string really start?
For that reason there was taken the decision by IDM to ultimately solve this problem by introducing a new decoding of binary recorded/stored macros and encoding of macro sources entered directly in Edit/Create Macro
dialog window containing one of the four macro commands Find
For all strings of those four commands, and only those four commands, the rules regarding to "
(straight double quote) and \
(backslash) are as follows:
- A double quote inside a string must be always escaped with a backslash.
- A backslash inside a string must be escaped with a backslash only
- if the backslash is the last character on a string like the directory path on FindInFiles, or
- if the backslash is followed by a double quote or another backslash.
In every other case a single backslash has to be used for representing a single backslash.
ReplInFiles RegExp Log "C:\Temp\Test\\
" "*.txt" "(\\\"
)" "\1 \2"
A multi-line Perl regular expression search string is used here to replace for example
in all *.txt files in directory C:\Temp\Test\
The first "
is escaped unnecessarily in Perl regular expression search string with a backslash
which requires two more escaping backslashes
resulting in \\\"
As a \
in a Perl regular expression string must be escaped with a backslash
to be interpreted as literal character, the search string in Edit/Create Macro
dialog window must be escaped with one more backslash
resulting in \\\
as last but one character of Perl regular expression search string must be escaped with a backslash
resulting in \"
What is the search string really entered on recording this Perl regular expression Replace in Files
Better would be using the search string (\x22.+)\x5C\r\n(.+\x22)
which is the same search string for Perl regular expression engine, but no character must be escaped in Edit/Create Macro
dialog window on using this variant.
What does this mean for existing macros?
Every macro code posted in the forums containing Find
or stored in text files as backup to binary *.mac files not explicitly using this syntax and containing in a search/replace string a double quote or a backslash as last character on a string or \"
needs to be modified before the macro code can be copied into Edit/Create Macro
dialog window and compiled by UE v25.00.0.82 or UEStudio v18.00 or any later version.
Otherwise (hopefully) following error message is displayed on closing the Edit/Create Macro
dialog window and confirming to update the macro:
Incorrect Macro Command Parameter
At least one string parameter contains improperly escaped quotes or
backslashes, or the expected amount of string parameters was not met.
Macros recorded or created with UltraEdit for Windows < 25.00 or UEStudio < v18.00 and stored already binary as *.mac files work as long as UltraEdit/UEStudio doesn't fail to upgrade the binary macro code on load for whatever reason
. Macros created with any build of UltraEdit v25.10 stored as binary *.mac file work also with any build of UltraEdit v25.00.
What is about macro usage and editing with UE versions 25.00.0.53, 25.00.0.58, 25.00.0.59 and 25.00.0.68?
Those are the public released versions of UltraEdit version 25.00 prior version 25.00.0.82.
Macros containing one of the four commands recorded with those three builds of UE v25.00 work. But it is nearly
impossible with those three commands to make any modification on any macro containing Find
with Edit/Create Macro
PS: The Windows commands forfiles
use the same special interpretation of backslashes within an argument string of the command.