uncommenting a line in file is not working

Hello Experts,

my ansible play book is working for me to uncomment certain lines in a .conf file, but its failing for one particular line its not making any change.

below is my .conf file part.


#<VirtualHost *:443>
#SSLEnable
#Header always set Strict-Transport-Security “max-age=31536000; includeSubDomains; preload”
#

Expected output

You have a * in you data, * is a regexp special character, when you are using a special character as a literal character you need to escape it.
So this should work:
  regexp: '^#(.*<VirtualHost \*:443>.*)'

Hello Kai,

Great Advise!!! Thanks a lot for your help. It worked like a magic…