Ansible help regex

Hello, I was wondering if someone can possible help me with my Ansible playbook. I have a file called myfile.yml with a line that contains an image. Example line:

service: blahblah image: myoldimagename blahblah

I want to change everything after the word "image: " with a configuration line, however I’m having trouble. For example, I want to replace “myoldimagename” with “mynewline”. I don’e want to match “myoldimagename” explicitly because that may be different.

`

  • name: Configure myfile.yml
    replace:
    path: /data/config/myfile.yml
    regexp: “(?<=image: ).*”
    replace: \1mynewline
    backup: yes
    `

see https://www.regular-expressions.info/lookaround.html for explanations.
lookaround is not consuming any characters.

try on https://regex101.com/ to make it concrete about what is matched or not

HTH
Phil