Hey Bob,
When I change it to this, it works:
edit_line => my_replace("\*mode:\s+(?!blank.*).*", "*mode: blank"),
In my short test file, it works just fine. However, when I add it to my site.cf file:
error: Promised replacement 'mode: blank' for pattern '^(\ mode:\s+(?!blank.*).*)\(' is not properly convergent while editing '/etc/X11/app- defaults/XScreenSaver-nogl' (pattern still matches the end-state replacement string '*mode: blank', consider use of a negative look ahead) error: Errors encountered when actuating replace_patterns promise '^(\*mode:\ s+(?!blank.*).*)\)'
What could be the difference?
I think it should be like this:
edit_line => my_replace("\*mode:\s+(?!blank$).*$",
But, I think that this might be of use to you as well: https://gist.github.com/nickanderson/1ffd7936b66b4a7c1e703fbbdc49e0d1
Thanks, Nick. FYI - I updated to "core" 3.24.2.
I tried the following scenarios after the update:
edit_line => my_replace("\*mode:\s+(?!blan.*\().*", edit_line => my_replace("\*mode:\s+(?!blank.*).*", edit_line => my_replace("\*mode:\s+(?!blan.+).*", edit_line => my_replace("\*mode:\s+(?!blank\)).*", edit_line => my_replace("\*mode:\s+(?!blank\().*\)", edit_line => my_replace("\*mode:\s+(?!blank).*",
All of which gave the same error (but did perform the edit). On subsequent runs of cf-agent, the file is no longer edited/updated. I suspect this is a glitch of some sort.
Yeah, I am not good enough with regex to know without running it for myself. But that gist I linked to worked for me when I was playing around last night. Hopefully you can adapt it for yourself.