mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-06 10:43:14 +00:00
Update the regex_findall example (#43052)
<!--- Your description here -->
The example has:
`{{ 'Some DNS servers are 8.8.8.8 and 8.8.4.4' | regex_findall('\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b') }}`
It needs be double backslashes to escape the backslashes:
`{{ 'Some DNS servers are 8.8.8.8 and 8.8.4.4' | regex_findall('\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}\\b') }}`
+label: docsite_pr
This commit is contained in:
@@ -992,7 +992,7 @@ To search a string with a regex, use the "regex_search" filter::
|
||||
To search for all occurrences of regex matches, use the "regex_findall" filter::
|
||||
|
||||
# Return a list of all IPv4 addresses in the string
|
||||
{{ 'Some DNS servers are 8.8.8.8 and 8.8.4.4' | regex_findall('\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b') }}
|
||||
{{ 'Some DNS servers are 8.8.8.8 and 8.8.4.4' | regex_findall('\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}\\b') }}
|
||||
|
||||
|
||||
To replace text in a string with regex, use the "regex_replace" filter::
|
||||
|
||||
Reference in New Issue
Block a user