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

Reply via email to