Not sure what you mean i.e. did you expect a match or not?

I did try your example and it works for me or should I say it is a match!!!

Marco

-----Original Message-----
From: nwat...@symcor.com [mailto:nwat...@symcor.com] 
Sent: Wednesday, February 17, 2010 2:32 PM
To: Lebel, Marco
Cc: help-cfengine@cfengine.org
Subject: RE: regcmp help

You are right the regex expects to look at the whole line.  That is not as 
I would expect from a regular expression.  I think this leads to a 
problem.  Consider this new example where the string continues to another 
line.

######################
body common control {
    bundlesequence => { "test" };
}

bundle common agent {
    classes:
        "all" expression => "any";
}


bundle agent test {

    vars:

        "reg" string => "OpenSSH";
        "str" string => "SSH-OpenSSH-4.3
 newline";

    classes:

        "port" expression => regcmp(".*${reg}.*","${str}");

    reports:

        port::
        "Port match!";
        !port:: 
        "No port match!";

}
[nwat...@unxxhd01 inputs]$ ~/src/cfengine-3.0.3/src/cf-agent -Kf 
./regcmp.cf 
R: No port match!

[nwat...@unxxhd01 inputs]$ echo "SSH-OpenSSH-4.3
>  newline"|pcregrep "OpenSSH"
SSH-OpenSSH-4.3

Sincerely,
--
Neil Watson
416-673-3465
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to