Re: Matching host names by regexp

2010-04-21 Thread Erlend Leganger
On 21 April 2010 17:48, Justin Lloyd wrote: > FWIW, for scalability I'd probably use $(sys.uqhost) to ensure that > classmatch is not matching against another class that may exist and just > happens to look like a valid hostname. > > classes: > "svxx" expression => regcmp("sv[0-9]{2}", "$(sys.uq

RE: Matching host names by regexp

2010-04-21 Thread Justin Lloyd
ustin -Original Message- From: help-cfengine-boun...@cfengine.org [mailto:help-cfengine-boun...@cfengine.org] On Behalf Of Erlend Leganger Sent: Wednesday, April 21, 2010 3:02 AM To: Cfengine help Subject: Re: Matching host names by regexp Perfect, why didn't I think of that - nice an

Re: Matching host names by regexp

2010-04-21 Thread Erlend Leganger
Perfect, why didn't I think of that - nice and simple. With this and a more precise (and less readable) regexp, I now have the following: classes: "svxx" expression => classmatch("sv[0-9]{2}"); #sv00, sv01, ..., sv99 Thanks, Erlend On 21 April 2010 08:57, Mark Burgess wrote: > > Sorry, I f

Re: Matching host names by regexp

2010-04-20 Thread Mark Burgess
Sorry, I forgot to remove a { classes: "svxx" expression => classmatch("sv.."); Mark Burgess wrote: > Oh, I didn't notice that. But why not simply write > > classes: >"svxx" expression =>{classmatch("sv.."); > > Erlend Leganger wrote: >> I guess it's the and-any construct that looks st

Re: Matching host names by regexp

2010-04-20 Thread Mark Burgess
Oh, I didn't notice that. But why not simply write classes: "svxx" expression =>{classmatch("sv.."); Erlend Leganger wrote: > I guess it's the and-any construct that looks strange to me, it's like > writing a boolean expression with an "and True" at the end: > > if ($condition && 1){ > &do

Re: Matching host names by regexp

2010-04-20 Thread Erlend Leganger
Good point, the servers are identified with two digit numbers, so the regex should match two digit numbers only - thanks. - Erlend On 21 April 2010 07:22, Сева Глущенко wrote: > Hello Erlend, > > It seems like you've got the best way already. You may just narrow > regexp a bit, e.g. > >  classe

Re: Matching host names by regexp

2010-04-20 Thread Erlend Leganger
I guess it's the and-any construct that looks strange to me, it's like writing a boolean expression with an "and True" at the end: if ($condition && 1){ &do_something; } But if this is the best way, I won't complain. - Erlend On 21 April 2010 07:19, Mark wrote: > Why do you say this is convo