The ``regex_search`` filter returns an empty string if it cannot find a match::
{{ 'ansible' | regex_search('foobar') }}
# => ''
Note that due to historic behavior and custom re-implementation of some of the Jinja internals in Ansible there is an exception to the behavior. When used in a Jinja expression (for example in conjunction with operators, other filters, and so no) the return value differs, in those situations the return value is ``none``. See the two examples below::
{{ 'ansible' | regex_search('foobar') == '' }}
# => False
{{ 'ansible' | regex_search('foobar') == none }}
# => True
When ``jinja2_native`` setting is enabled, the ``regex_search`` filter always returns ``none`` if it cannot find a match.
To extract all occurrences of regex matches in a string, use the ``regex_findall`` filter::