Dollar Signs next to numerals in Text File Search/Replace - Advanced Installer Community
glencircle
Posts: 2
Joined: Tue Mar 24, 2015 8:23 pm

Dollar Signs next to numerals in Text File Search/Replace

I'm doing a Text File Update to insert passwords gathered in a dialog pane into configuration files.

I've noticed that when the password includes a dollar sign followed by a numeral, it disappears in the resulting string. $0 is interesting: it inserts the "Search" parameter. I'm not using regular expressions - however, is it possible that the replacement string is still using RegExp back references?
glencircle
Posts: 2
Joined: Tue Mar 24, 2015 8:23 pm

Re: Dollar Signs next to numerals in Text File Search/Replac

I found a workaround. The documentation mentions to use ECMAScript syntax for regexp. Assuming this means String.prototype.replace() is being used, that would mean dollar-signs are correctly escaped by using two in a row.

A custom action in VBScript like this allows me to escape and repackage my (potentially troublesome) passwords like so:

Code: Select all

Session.Property("MOD_PASSWORD") = Replace(Session.Property("ORIG_PASSWORD"), "$", "$$")
Using this [MOD_PASSWORD] property in the Text File Update's Replace field gives me what I want, regardless of having turned regular expressions on or off.

Tough call as to whether or not this is a bug, but documentation would help. :)
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Dollar Signs next to numerals in Text File Search/Replac

Hello and welcome to Advanced Installer forums,

I've tested the scenario and I replicated the behavior. Indeed, it seems if you are using in the "Replace" field character sequences which are special ECMAScript expression, then they won't be escaped but will be resolved using ECMAScript rules. This seems to be an Advanced Installer limitation. We'll try to add a fix for this in a future version of Advanced Installer, thank you for bringing it to our attention.

Until then, as a workaround, as you already found you can use a custom action which, if found, will escape the "$" character.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Dollar Signs next to numerals in Text File Search/Replac

Hello,

This was fixed in version 12.1 of Advanced Installer released on May 19th, 2015.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”