Hi everyone -
I’m attempting to use the strReplace helper function within a configuration template to replace a backslash \ character with a forward slash / in a path. In my template, I’ve tried the lines of code below:
- {{strReplace pkg.path “\\” “/”}}
- {{strReplace pkg.path ‘\\’ “/”}}
- {{strReplace pkg.path ‘\’ “/”}}
- {{strReplace pkg.path “\” “/”}}
Every time I try to run my package, it fails with a template syntax error similar to what is shown below:
components\sup\src\manager\service\config.rs: TemplateError(TemplateError { reason: InvalidSyntax, template_name: Some(“my_file.config”), line_no: Some(47), column_no: Some(93) })
If I try the following line of code, though, it will work as expected and replace a value within the pkg.path string:
- {{strReplace pkg.path “test” “test2”}}
Does anyone know how to properly escape a backslash using the strReplace helper?