You're using the "comment" regex to match lines that DON'T look like
something... Try this:
"dim_array" int =>
readstringarrayidx("array","datafile","^(?!VM;[^;]*;name1;).+",";",10,10000);
The regex says "anything, as long as you don't seeVM;stuff;name1;, is a
comment". I think it'll work...
-Dan
On Jun 27, 2011, at 8:55 AM, [email protected] wrote:
> Forum: Cfengine Help
> Subject: Function readstringarrayidx () - Need Regex help
> Author: joe77
> Link to topic: https://cfengine.com/forum/read.php?3,22623,22623#msg-22623
>
> Hi,
> I have a problem with readstringarrayidx ()
>
> 1. I want to read from this example datafile
> #######################
> VM;bv10;name1;vlan142;192
> VM;bv11;name2;vlan122;102
> VM;bv12;name1;vlan102;103
> ########################
>
> I want to select the lines where "VM" and "name1" are present (line 2 should
> be "removed") but i am not getting the regexp correct. Tried maaaany
> different ones ;)
> I just started to learn about regular expressions. I know that this function
> is unanchored. But using anchors like "^" or "$" didnt work either.
>
> ####################
> REGEX= VM.*name1.*
> "dim_array" int =>
> readstringarrayidx("array","datafile","REGEX",";",10,10000);
> #######
> Can someone give me a hint about finding the correct REGEX?
> Thanks in advance
> Joe
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine