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



2018-04-04 2:00 GMT+02:00 Numi <numeth...@gmail.com>:

> 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
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/4f2d6e8a-516c-4b34-bf30-d33670de654e%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/4f2d6e8a-516c-4b34-bf30-d33670de654e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAB1FMuSXxEzCnp%3D_Br_QdFeYq6xpxch_MFpQZ8Dt2t9CgHUvTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to