A few comments
escbackslash
vs. escregexp
: escbackslash
is probably only useful outside renames (though it often will work). For any regex rename, use escregexp
.
the modifier only affects what is inside the curly brackets. Apparently not
Rule: The modifier only affects what is inside the curly brackets!
Look further down for an exception
single vs. double quotes: a pure JScript thing. I like to use single quotes for JScript and reserve the double quotes for Opus commands. Going "all double quotes" is possible, but then you would need even more \
The string a written within the script (I call this the "in script" form) has 4 backslashes see Note 2 below. Why?
The script variant has \\\\
because the normal command has \\
. Why? Again, a pure JScript thing: "backslashes need to be escaped (with backslashes)". Period
So the more interesting question is: Why does the normal variant use \\
?
Well, I thought I had a good explanation. Turned out I didn't. At least not in the way I originally envisioned. I now think it's a bug. I've written a separate report.
General advice: There is nothing wrong with using codes in Rename statements, especially if you want to be able to later/again/also use the statements in normal (non-script) buttons. But if you go all-in with scripting, use the item properties and the JScript regex support. It'll make your code a lot easier to understand/debug/maintain