Using Filters in Ansible

filters

regex_search

  • search a string to extract the part that matches a regular expression.

Extract the database name from a string: {{ 'server1/database42' | regex_search('database[0-9]+') }}

Returns: database42