Update regex_* docs (#81016)

* Update regex_* docs
* Remove Python 3 regex link
* Added references to inline regex flags

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/81190/head
Abhijeet Kasurde 1 year ago committed by GitHub
parent 7c6564ad0e
commit 1ca03139cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,6 +27,12 @@ EXAMPLES: |
# all_pirates => ['CAR', 'tar', 'bar']
all_pirates: "{{ 'CAR\ntar\nfoo\nbar\n' | regex_findall('^.ar$', multiline=True, ignorecase=True) }}"
# Using inline regex flags instead of passing options to filter
# See https://docs.python.org/3/library/re.html for more information
# on inline regex flags
# all_pirates => ['CAR', 'tar', 'bar']
all_pirates: "{{ 'CAR\ntar\nfoo\nbar\n' | regex_findall('(?im)^.ar$') }}"
# get_ips => ['8.8.8.8', '8.8.4.4']
get_ips: "{{ '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') }}"

@ -40,6 +40,12 @@ EXAMPLES: |
# piratecomment => '#CAR\n#tar\nfoo\n#bar\n'
piratecomment: "{{ 'CAR\ntar\nfoo\nbar\n' | regex_replace('^(.ar)$', '#\\1', multiline=True, ignorecase=True) }}"
# Using inline regex flags instead of passing options to filter
# See https://docs.python.org/3/library/re.html for more information
# on inline regex flags
# piratecomment => '#CAR\n#tar\nfoo\n#bar\n'
piratecomment: "{{ 'CAR\ntar\nfoo\nbar\n' | regex_replace('(?im)^(.ar)$', '#\\1') }}"
RETURN:
_value:
description: String with substitution (or original if no match).

@ -29,6 +29,12 @@ EXAMPLES: |
# db => 'database42'
db: "{{ 'server1/database42' | regex_search('database[0-9]+') }}"
# Using inline regex flags instead of passing options to filter
# See https://docs.python.org/3/library/re.html for more information
# on inline regex flags
# server => 'sErver1'
db: "{{ 'sErver1/database42' | regex_search('(?i)server([0-9]+)') }}"
# drinkat => 'BAR'
drinkat: "{{ 'foo\nBAR' | regex_search('^bar', multiline=True, ignorecase=True) }}"

Loading…
Cancel
Save