Searching strings with regular expressions
To search in a string or extract parts of a string with a regular expression, use theansible.builtin.regex_searchfilter:
To extract all occurrences of regex matches in a string, use theansible.builtin.regex_findallfilter:
To replace text in a string with regex, use theansible.builtin.regex_replacefilter:
To escape special characters within a standard Python regex, use theansible.builtin.regex_escapefilter (using the defaultre_type='python'option):
To escape special characters within a POSIX basic regex, use theansible.builtin.regex_escapefilter with there_type='posix_basic'option: