Re: [Puppet Users] Re: Puppet .... ruby regex

2016-08-04 Thread Alex Samad
> > 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] > >> >

Re: [Puppet Users] Re: Puppet .... ruby regex

2016-08-04 Thread R.I.Pienaar
- 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']}".

Re: [Puppet Users] Re: Puppet .... ruby regex

2016-08-04 Thread Robert Poulson
> > $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

[Puppet Users] Re: Puppet .... ruby regex

2016-08-03 Thread Alex Samad
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

[Puppet Users] Re: Puppet / Ruby Regex match

2015-04-23 Thread TheNerd
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

[Puppet Users] Re: Puppet / Ruby Regex match

2015-04-23 Thread jcbollinger
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][/