You misunderstand what is being matched against. That's documented. It doesn't say that is *searches* the string. It says it matches the string. You confused // notation which is a search not a comparison.
nwat...@symcor.com wrote: > Mark Burgess <mark.burg...@iu.hio.no> wrote on 2010-02-17 15:09:29: > >> There wouldn't be a line break in your line. This is standard regex >> stuff. Regexs don't go >> through line breaks. > > The desired atom is before the line break. This I expect to match as it > does with pcregrep, sed, grep and perl. > > [nwat...@unxxhd01 inputs]$ cat regcmp.cf > ###################### > body common control { > bundlesequence => { "test" }; > } > > bundle common agent { > classes: > "all" expression => "any"; > } > > > bundle agent test { > > vars: > > "reg" string => "OpenSSH"; > "str1" string => "SSH-OpenSSH-4.3"; > "str2" string => "SSH-OpenSSH-4.3 > newline"; > > classes: > > "port1" expression => regcmp(".*${reg}.*","${str1}"); > "port2" expression => regcmp(".*${reg}.*","${str2}"); > # Both should match > > reports: > > port1:: > "Port1 match!"; > !port1:: > "No port1 match!"; > port2:: > "Port2 match!"; > !port2:: > "No port2 match!"; > > } > > [nwat...@unxxhd01 inputs]$ ~/src/cfengine-3.0.3/src/cf-agent -Kf > ./regcmp.cf > R: Port1 match! > R: No port2 match! > > As a wish list item I wish that CF's regular expressions were more like > PCRE than they are. CF does use PCRE but it is more of a dialect. Having > to add '.*' and extra escapes (e.g \\s intead of \s) requires one to learn > another regex flavour. > > Sincerely, > -- > Neil Watson > 416-673-3465 > > > ------------------------------------------------------------------------ > > > > CONFIDENTIALITY WARNING > This communication, including any attachments, is for the exclusive use of > addressee and may contain proprietary and/or confidential information. If you > are not the intended recipient, any use, copying, disclosure, dissemination > or distribution is strictly prohibited. If you are not the intended > recipient, please notify the sender immediately by return e-mail, delete this > communication and destroy all copies. > > AVERTISSEMENT RELATIF À LA CONFIDENTIALITÉ > Ce message, ainsi que les pièces qui y sont jointes, est destiné à l’usage > exclusif de la personne à laquelle il s’adresse et peut contenir de > l’information personnelle ou confidentielle. Si le lecteur de ce message n’en > est pas le destinataire, nous l’avisons par la présente que toute diffusion, > distribution, reproduction ou utilisation de son contenu est strictement > interdite. Veuillez avertir sur-le-champ l’expéditeur par retour de courrier > électronique et supprimez ce message ainsi que toutes les pièces jointes. -- Mark Burgess ------------------------------------------------- Professor of Network and System Administration Oslo University College, Norway Personal Web: http://www.iu.hio.no/~mark Office Telf : +47 22453272 ------------------------------------------------- _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine