From 8a754e0858d922e955e71b253c139e071ecec432 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 18:04:21 +0200 Subject: Adding upstream version 2.14.3. Signed-off-by: Daniel Baumann --- lib/ansible/plugins/filter/regex_search.yml | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/ansible/plugins/filter/regex_search.yml (limited to 'lib/ansible/plugins/filter/regex_search.yml') diff --git a/lib/ansible/plugins/filter/regex_search.yml b/lib/ansible/plugins/filter/regex_search.yml new file mode 100644 index 0000000..c61efb7 --- /dev/null +++ b/lib/ansible/plugins/filter/regex_search.yml @@ -0,0 +1,38 @@ +DOCUMENTATION: + name: regex_search + version_added: "2.0" + short_description: extract regex match from string + description: + - Search in a string to extract the part that matches the regular expression. + notes: + - Maps to Python's C(re.search). + positional: _input, _regex + options: + _input: + description: String to match against. + type: str + required: true + _regex: + description: Regular expression string that defines the match. + type: str + multiline: + description: Search across line endings if C(True), do not if otherwise. + type: bool + default: no + ignorecase: + description: Force the search to be case insensitive if C(True), case sensitive otherwise. + type: bool + default: no + +EXAMPLES: | + + # db => 'database42' + db: "{{ 'server1/database42' | regex_search('database[0-9]+') }}" + + # drinkat => 'BAR' + drinkat: "{{ 'foo\nBAR' | regex_search('^bar', multiline=True, ignorecase=True) }}" + +RETURN: + _value: + description: Matched string or empty string if no match. + type: str -- cgit v1.2.3