Merge pull request #102 from pragdave/master

Add one more "unicode" option in expand_env_variable—I have a bullet in my prompt that was blowing it up
This commit is contained in:
Dave Smith 2013-06-24 12:20:37 -07:00
commit be8b022a82

View file

@ -191,11 +191,11 @@ expand_env_variable(InStr, VarName, RawVarValue) ->
%% No variables to expand %% No variables to expand
InStr; InStr;
_ -> _ ->
VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", [global]), ReOpts = [global, unicode, {return, list}],
VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", ReOpts),
%% Use a regex to match/replace: %% Use a regex to match/replace:
%% Given variable "FOO": match $FOO\s | $FOOeol | ${FOO} %% Given variable "FOO": match $FOO\s | $FOOeol | ${FOO}
RegEx = io_lib:format("\\\$(~s(\\s|$)|{~s})", [VarName, VarName]), RegEx = io_lib:format("\\\$(~s(\\s|$)|{~s})", [VarName, VarName]),
ReOpts = [global, {return, list}, unicode],
re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts) re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts)
end. end.