I am trying to use the replace module on a text file to replace any instances of the regex matches that it finds (NOT including the 's around it). I am basically just searching for an entire string or number (3306) or (myhostname) inside of a text file.
Unfortunately, the regex I am defining here is not detecting the string correctly. The examples I am finding on regextester seem to not be working correctly.
  tasks:
    - name: Rename the host database strings inside of each tenants settings.php file
      replace:
        dest: /var/www/html/someFile.txt 
        regexp: "/ec2-52-11-164-22.compute-1.amazonaws.com/g"
        replace: 127.0.0.1
    - name: Rename the port inside of each tenants settings.php file
      replace:
        dest: /var/www/html/someFile.txt 
        regexp: "/3306/g"
        replace: 4006
This is the text I am searching through -
Server1
        'host' => 'ec2-52-11-164-22.compute-1.amazonaws.com',
        'port' => '3306',
Server2
        'host' => 'ec2-34-112-123-53.compute-1.amazonaws.com',
What would be the proper regex to select those two strings without with 's?
 
     
    