> > To: "puppet-users" >
> > Sent: Thursday, 4 August, 2016 16:42:21
> > Subject: Re: [Puppet Users] Re: Puppet ruby regex
>
> >>
> >> $pp_shortcertname= "${trusted['certname']}".match(/([^.]+)\./)[1]
> >>
>
- Original Message -
> From: "Robert Poulson"
> To: "puppet-users"
> Sent: Thursday, 4 August, 2016 16:42:21
> Subject: Re: [Puppet Users] Re: Puppet ruby regex
>>
>> $pp_shortcertname= "${trusted['certname']}".
>
> $pp_shortcertname= "${trusted['certname']}".match(/([^.]+)\./)[1]
>
> not sure I fully understand why this works and [] doesn't.
>
> Not 100% sure I understand what the [1] does !
>
The parentheses are for capturing the matching text, and \1 for re-using it
as a backreference; [1] outside of t
so got to this
$pp_shortcertname= "${trusted['certname']}".match(/([^.]+)\./)[1]
not sure I fully understand why this works and [] doesn't.
Not 100% sure I understand what the [1] does !
A
On Thursday, 4 August 2016 16:17:55 UTC+10, Alex Samad wrote:
>
> Hi
>
> I want to take ${trusted['certna
Thanks! I will give it a whirl.
On Thursday, April 23, 2015 at 7:12:01 AM UTC-7, jcbollinger wrote:
>
>
>
> On Wednesday, April 22, 2015 at 6:36:01 PM UTC-5, TheNerd wrote:
>>
>> Hi,
>>
>> So I have have the following ruby script for puppet, located in
>> /etc/puppetlabs/puppet/environments/produ
On Wednesday, April 22, 2015 at 6:36:01 PM UTC-5, TheNerd wrote:
>
> Hi,
>
> So I have have the following ruby script for puppet, located in
> /etc/puppetlabs/puppet/environments/production/modules/base/lib/facter
>
>
> Facter.add(:appname) do
> setcode do
>Facter.value(:hostname)[5..-1][/