Ansible docs point us on python re web site for regex. In this page, modifiers like ignore case, single line mode are documented, but it seems not supported when used with ansible module where regex is used (like lineinfile)
Someone find out how works with (?s) aka single-line mode?
usage: useful to insert line in the rigth place in a file like:
Input:
regex to insert "foobar" line after "foo" followed by "bar"
substitution:
Result:
"...
(?iLmsux)
(One or more letters from the set 'i', 'L', 'm', 's',
'u', 'x'.) The group matches the empty string; the letters
set the corresponding flags: re.I (ignore case),
re.L (locale dependent), re.M (multi-line),
re.S (dot matches all), re.U (Unicode dependent),
and re.X (verbose), for the entire regular expression. (The
flags are described in Module Contents.) This
is useful if you wish to include the flags as part of the regular
expression, instead of passing a flag argument to the
re.compile() function.
..."
Ansible should support this since is build-in in python and look very easy to support.
(Note: I am pretty new with ansible, python and i am not english. So, no bashing will be apreciated.. i am looking for a solution not useless comments)