RE: regcmp help

2010-02-17 Thread Justin Lloyd
3:37 PM To: Justin Lloyd Cc: nwat...@symcor.com; Mark Burgess; Lebel, Marco; help-cfengine@cfengine.org Subject: Re: regcmp help Howdy, PCRE allows you to set the /s flag using (?s) at the beginning of the regex: PCRE_DOTALL If this bit is set, a dot metacharater in the pattern m

Re: regcmp help

2010-02-17 Thread Diego Zamboni
!port2:: "No port2 match!"; } -Original Message- From: help-cfengine-boun...@cfengine.org [mailto:help-cfengine-boun...@cfengine.org] On Behalf Of Justin Lloyd Sent: Wednesday, February 17, 2010 3:01 PM To: nwat...@symcor.com; Mark Burgess Cc: Lebel, Marco; help-cfe

RE: regcmp help

2010-02-17 Thread Justin Lloyd
ginal Message- From: help-cfengine-boun...@cfengine.org [mailto:help-cfengine-boun...@cfengine.org] On Behalf Of nwat...@symcor.com Sent: Wednesday, February 17, 2010 1:41 PM To: Mark Burgess Cc: Lebel, Marco; help-cfengine@cfengine.org Subject: Re: regcmp help Mark Burgess wrote on 2010-02-17 15:

Re: regcmp help

2010-02-17 Thread NWatson
Mark Burgess wrote on 2010-02-17 15:37:36: > > .* only matches up to the newline, so you'll have to say > > .*REGEX.*\n.* That works. It's a bit painful compared with m// so I still wish for that :) Still thanks for the clarification and your patience with my stubbornness. Sincerely, --

Re: regcmp help

2010-02-17 Thread Mark Burgess
.* only matches up to the newline, so you'll have to say .*REGEX.*\n.* nwat...@symcor.com wrote: > .*OpenSSH.* still does not match > "SSH-OpenSSH-4.3 > newline"; > > I don't control the newline but I have to account for it somehow in my > 'match'. > > Sincerely, > -- > Neil Watson >

Re: regcmp help

2010-02-17 Thread NWatson
.*OpenSSH.* still does not match "SSH-OpenSSH-4.3 newline"; I don't control the newline but I have to account for it somehow in my 'match'. Sincerely, -- Neil Watson 416-673-3465 CONFIDENTIALITY WARNING This communication, including any attachments, is for the exclusive use of addres

Re: regcmp help

2010-02-17 Thread Mark Burgess
You can make it simply by writing .*REGEX.* nwat...@symcor.com wrote: > Mark Burgess wrote on 2010-02-17 15:25:23: > >> 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 >> // no

Re: regcmp help

2010-02-17 Thread NWatson
Mark Burgess wrote on 2010-02-17 15:25:23: > 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. Ack you are right. I assumed and

Re: regcmp help

2010-02-17 Thread Mark Burgess
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 wrote on 2010-02-17 15:09:29: > >> There woul

Re: regcmp help

2010-02-17 Thread NWatson
Mark Burgess 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

Re: regcmp help

2010-02-17 Thread Mark Burgess
There wouldn't be a line break in your line. This is standard regex stuff. Regexs don't go through line breaks. M nwat...@symcor.com wrote: > Mark Burgess wrote on 2010-02-17 15:01:05: > >> If there is a line break, use \n in the expression > > Assuming I know that there is a line break. Ty

Re: regcmp help

2010-02-17 Thread NWatson
Mark Burgess wrote on 2010-02-17 15:01:05: > > If there is a line break, use \n in the expression Assuming I know that there is a line break. Typically one wants to match a known string, described as regular expression, in an unknown or unpredictable string. In this example the desire is to

Re: regcmp help

2010-02-17 Thread Mark Burgess
If there is a line break, use \n in the expression nwat...@symcor.com wrote: > This > "reg" string => "OpenSSH"; > "str" string => "SSH-OpenSSH-4.3 > newline"; # Continued from previous line > > classes: > > "port" expression => regcmp(".*${reg}.*","${str}"); > > S

RE: regcmp help

2010-02-17 Thread NWatson
This "reg" string => "OpenSSH"; "str" string => "SSH-OpenSSH-4.3 newline"; # Continued from previous line classes: "port" expression => regcmp(".*${reg}.*","${str}"); Should match. In my previous post the example die not match. I suspect this is because of the new

RE: regcmp help

2010-02-17 Thread Lebel, Marco
-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

RE: regcmp help

2010-02-17 Thread NWatson
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 => { "tes

RE: regcmp help

2010-02-17 Thread Lebel, Marco
rg Subject: regcmp help A regcmp I would expect to match does not. What have I done wrong? [nwat...@unxxhd01 inputs]$ cat regcmp.cf ## body common control { bundlesequence => { "test" }; } bundle common agent { classes: "all" expressio

Re: regcmp help

2010-02-17 Thread Michael Potter
I think regcmp needs to match the whole string, not part of it. On 18/02/2010 6:17 AM, wrote: A regcmp I would expect to match does not. What have I done wrong? [nwat...@unxxhd01 inputs]$ cat regcmp.cf ## body common control { bundlesequence => { "test" }; } bundle com

regcmp help

2010-02-17 Thread NWatson
A regcmp I would expect to match does not. What have I done wrong? [nwat...@unxxhd01 inputs]$ cat regcmp.cf ## body common control { bundlesequence => { "test" }; } bundle common agent { classes: "all" expression => "any"; } bundle agent test { classe