RedHatGov / redhatgov.workshops

This is a collection of Ansible-deployed workshop environments. Use it in combination with the student workbook content, from the repo at https://github.com/RedHatGov/redhatgov.github.io
http://redhatgov.io
65 stars 69 forks source link

Fixing syntax error from regex_replace function #127

Closed ChubaOraka closed 4 years ago

ChubaOraka commented 4 years ago

According to the regex notation used in Ansible documentation, shorthand characters and backreferences used in regex filter should be preceded by two backslashes (\\) in YAML. According to the same documentation:

Prior to ansible 2.0, if “regex_replace” filter was used with variables inside YAML arguments (as opposed to simpler ‘key=value’ arguments), then you needed to escape backreferences (for example, \\1) with 4 backslashes (\\\\) instead of 2 (\\).

So it appears that the source of your troubles with regex_replace is the number of backslashes. This is not surprising as it is a little different from the the notation used in Perl or even in the Python script in the rest of the project.

ajacocks commented 4 years ago

Thanks for the submission, but we were working on this, too. Closed by #128