mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
parent
2e29993729
commit
41a417be1f
1 changed files with 4 additions and 2 deletions
|
@ -559,6 +559,8 @@ To replace text in a string with regex, use the "regex_replace" filter::
|
||||||
.. note:: Prior to ansible 2.0, if "regex_replace" filter was used with variables inside YAML arguments (as opposed to simpler 'key=value' arguments),
|
.. note:: 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 (e.g. ``\\1``) with 4 backslashes (``\\\\``) instead of 2 (``\\``).
|
then you needed to escape backreferences (e.g. ``\\1``) with 4 backslashes (``\\\\``) instead of 2 (``\\``).
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
To escape special characters within a regex, use the "regex_escape" filter::
|
To escape special characters within a regex, use the "regex_escape" filter::
|
||||||
|
|
||||||
# convert '^f.*o(.*)$' to '\^f\.\*o\(\.\*\)\$'
|
# convert '^f.*o(.*)$' to '\^f\.\*o\(\.\*\)\$'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue