On Wed, 3 Mar 2010 12:46:05 -0800, Eric Sorenson <ahp...@gmail.com> wrote: > This might just be a style nitpick, but why anchor the start and then .* > match? Just start your regexp where you want the match to start. You have > a nice anchor at the end so the regexp will optimize backwards from there. > Compare readability: > > On Mar 3, 2010, at 9:09 AM, James Cammarata wrote: > >> package { "kernel-development": >> ensure => "present", >> name => $kernelrelease ? { >> /^.*\.(EL|el)largesmp$/ => "kernel-largesmp-devel", >> /^.*\.(EL|el)hugemem$/ => "kernel-hugemem-devel", >> /^.*\.(EL|el)smp$/ => "kernel-smp-devel", >> default => undef, >> }, >> } > > vs > >> package { "kernel-development": >> ensure => "present", >> name => $kernelrelease ? { >> /(EL|el)largesmp$/ => "kernel-largesmp-devel", >> /(EL|el)hugemem$/ => "kernel-hugemem-devel", >> /(EL|el)smp$/ => "kernel-smp-devel", >> default => undef, >> }, >> }
Yeah the ^.* isn't really required, but I did want to leave in the \. to ensure that it starts the match there. Anyways it's just a few extra characters, I'm not going to sweat it either way. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.