Hi,
I have
`
- name: update file1 with 0 in the end if it missing
replace:
backup: yes
dest: /tmp/file1
regexp: ‘^(start of line.*[^0])$’
replace: ‘\1 0’
`
This add 0 to lines that start with “start of line”.
It’s run okay if there are no empty lines between.
If there is empty line under the match line it add the 0 to the empty line.
For example, the 2 lines:
`
start of line fjhdsjkfhdsk
`
will be:
start of line fjhdsjkfhdsk 0
instead of:
`
start of line fjhdsjkfhdsk 0
`
I tried to add the (?<!0) the look behind - but don’t work at all.
How can I make it catch the first new line?