Hello, Sauer,

I was thinking about exactly the same thing - if there are perl regexp's 
than perhaps some of these things could be used. I didn't try \L though, 
I am no perl programmer, but was very eager to learn if that's possible.

Now seeing that it's not... Well, I will use just another workaround. 
Actually I only needed to use the lowercase'd variable in a config file 
and I decided to use Template Toolkit for generating the file.

Cheers,
B

On 20/06/11 06:58, no-re...@cfengine.com wrote:
> Forum: Cfengine Help
> Subject: Re: Variable to lowercase
> Author: sauer
> Link to topic: https://cfengine.com/forum/read.php?3,22431,22524#msg-22524
>
> I was looking for a solution to this earlier as well.  I thought I'd be 
> super-clever and use the \L escape from perl's regexps (which lowercases 
> everything up to the next \E).  I thought I'd do a regextract with "\L(.*)\E" 
> as the pattern, and use the first backreference to get the lower-case'd 
> version.  But that plays "wha wha whaaaa" out the speaker (well, it should) 
> and gives this error:
>
>
> !! Could not parse regular expression '\L(.*)\E'
>   !!! System error for CompileRegExp: "Operation not permitted"
> Regular expression error "PCRE does not support \L, \l, \N, \U, or \u" in 
> expression "\L(.*)\E" at 1
>
>
> So, back to the drawing bord... :)  I'm still using tr.  Well, actually I use 
> a perl script in the modules directory to set a variable using the module 
> protocol like this:
>
> user@host $ cat ./tolower
> #!/usr/bin/perl
> print q{=},shift,q{=};
> print lc($_) foreach (@ARGV);
> print qq{\n};
> user@host $ ./tolower lowercased HeLLo
> =lowercased=hello
>
>
> but it's the same basic idea. ;)
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
>

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to