我無法在Ansible的regex_replace過濾器中找到很多文字(點)。這裏是任務:使用'regex_replace'匹配字面值Ansible filter
- name: Display database name
debug:
msg: "{{ vhost | regex_replace('(.+\.)(.+)$', \\1) }}"
tags: [debug]
我的目的是匹配並與它的第一部分(測試中的例子)更換整個URL像test.staging.domain.com。
Ansible會報告以下錯誤:
debug:
msg: "{{ vhost | regex_replace('(.+\.)(.+)$', \\1) }}"
^here
We could be wrong, but this one looks like it might be an issue with missing quotes. Always quote template expression brackets when they start a value.
我怎樣才能匹配Ansible regexp_replace
過濾文字?