Re: Look-ahead regex, not matching?

Bob <[email protected]> Wed, 9 Jul 2025 06:00:25 -0700 (PDT)
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
------=_Part_710072_450985594.1752066025466
Content-Type: multipart/alternative; 
	boundary="----=_Part_710073_1785102076.1752066025466"

------=_Part_710073_1785102076.1752066025466
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

No help. I also tried to remove the $ from edit_line bundle and that did=20
not appear to matter, either. :(

On Tuesday, July 8, 2025 at 5:54:48=E2=80=AFPM UTC-7 [email protected] wrote:

> Hi Bob,
>
> Try       edit_line     =3D> my_replace("\*mode:\s+(?!blank$)"
>
> On Tuesday, July 8, 2025 at 5:50:31=E2=80=AFPM UTC-5 Bob wrote:
>
>> I am trying to change the default screensaver. The line of interest is a=
s=20
>> follows:
>>
>> *mode:                  random
>>
>> Note: there are 3 tab characters between the colon and the word "random"=
.
>>
>> Code:
>>
>> body file control
>> {
>>     inputs =3D> { "/var/cfengine/share/CoreBase/masterfiles/lib/files.cf=
"=20
>> };
>> }
>>
>> body common control
>> {
>>       bundlesequence =3D> { "example" };
>> }
>>
>> bundle agent example
>> {
>>   files:
>>     linux::
>>       "/etc/X11/app-defaults/XScreenSaver-nogl"
>>       comment       =3D> "Set screensaver mode to blank",
>>       edit_line     =3D> my_replace("\*mode:\s+(?!blank)",
>>                                   "*mode:                       blank"),
>>       edit_defaults =3D> std_defs;
>>
>> }
>> bundle edit_line my_replace(regex,text)
>> {
>> replace_patterns:
>>
>>  "^($(regex))$"
>>
>>      replace_with =3D> value("$(text)"),
>>           comment =3D> "Search and replace string";
>> }
>>
>> As best as I can tell, I am not matching the line. Any suggestions?
>>
>> Using CFEngine community 3.24.1.
>>
>> Thank you.
>>
>>

--=20
You received this message because you are subscribed to the Google Groups "=
help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/help-cfengi=
ne/c0b12d63-83f6-4eb2-9fde-287c82a02dc2n%40googlegroups.com.

------=_Part_710073_1785102076.1752066025466
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

No help. I also tried to remove the $ from edit_line bundle and that did no=
t appear to matter, either. :(<br /><br /><div class=3D"gmail_quote"><div d=
ir=3D"auto" class=3D"gmail_attr">On Tuesday, July 8, 2025 at 5:54:48=E2=80=
=AFPM UTC-7 [email protected] wrote:<br/></div><blockquote class=3D"gmail_quo=
te" style=3D"margin: 0 0 0 0.8ex; border-left: 1px solid rgb(204, 204, 204)=
; padding-left: 1ex;"><div>Hi Bob,</div><div><br></div><div>Try=C2=A0<span =
style=3D"font-family:Courier New">=C2=A0 =C2=A0 =C2=A0 edit_line =C2=A0 =C2=
=A0 =3D&gt; my_replace(&quot;\*mode:\s+(?!blank$)&quot;</span></div><br><di=
v class=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">On Tuesday, =
July 8, 2025 at 5:50:31=E2=80=AFPM UTC-5 Bob wrote:<br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0 0 0 0.8ex;border-left:1px solid rgb(2=
04,204,204);padding-left:1ex"><div>I am trying to change the default screen=
saver. The line of interest is as follows:</div><div><br></div><div><span s=
tyle=3D"font-family:Courier New">*mode: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0random</span><br></div><div><br></div><div>Note:=
 there are 3 tab characters between the colon and the word &quot;random&quo=
t;.</div><div><br></div><div>Code:</div><div><br></div><div><span style=3D"=
font-family:Courier New">body file control<br>{<br>=C2=A0 =C2=A0 inputs =3D=
&gt; { &quot;/var/cfengine/share/CoreBase/masterfiles/lib/<a href=3D"http:/=
/files.cf" rel=3D"nofollow" target=3D"_blank" data-saferedirecturl=3D"https=
://www.google.com/url?hl=3Den&amp;q=3Dhttp://files.cf&amp;source=3Dgmail&am=
p;ust=3D1752152113076000&amp;usg=3DAOvVaw0auURe_BYycgB3zwvJ4-gw">files.cf</=
a>&quot; };<br>}<br><br>body common control<br>{<br>=C2=A0 =C2=A0 =C2=A0 bu=
ndlesequence =3D&gt; { &quot;example&quot; };<br>}<br><br>bundle agent exam=
ple<br>{<br>=C2=A0 files:<br>=C2=A0 =C2=A0 linux::<br>=C2=A0 =C2=A0 =C2=A0 =
&quot;/etc/X11/app-defaults/XScreenSaver-nogl&quot;<br>=C2=A0 =C2=A0 =C2=A0=
 comment =C2=A0 =C2=A0 =C2=A0 =3D&gt; &quot;Set screensaver mode to blank&q=
uot;,<br>=C2=A0 =C2=A0 =C2=A0 edit_line =C2=A0 =C2=A0 =3D&gt; my_replace(&q=
uot;\*mode:\s+(?!blank)&quot;,<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 &quot;*mode: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 blank&quot;),<br>=C2=A0 =C2=A0 =C2=A0 edit_defaults =
=3D&gt; std_defs;<br><br>}<br>bundle edit_line my_replace(regex,text)<br>{<=
br>replace_patterns:<br><br>=C2=A0&quot;^($(regex))$&quot;<br><br>=C2=A0 =
=C2=A0 =C2=A0replace_with =3D&gt; value(&quot;$(text)&quot;),<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 comment =3D&gt; &quot;Search and replace string&qu=
ot;;<br>}</span><br></div><div><br></div><div>As best as I can tell, I am n=
ot matching the line. Any suggestions?</div><div><br></div><div>Using CFEng=
ine community=C2=A03.24.1.</div><div><br></div><div>Thank you.</div><div><b=
r></div></blockquote></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;help-cfengine&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">help-=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
help-cfengine/c0b12d63-83f6-4eb2-9fde-287c82a02dc2n%40googlegroups.com?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/help-=
cfengine/c0b12d63-83f6-4eb2-9fde-287c82a02dc2n%40googlegroups.com</a>.<br /=
>

------=_Part_710073_1785102076.1752066025466--

------=_Part_710072_450985594.1752066025466--