5 module Puppet::Parser::Functions
6 newfunction(:grep, :type => :rvalue, :doc => <<-EOS
7 This function searches through an array and returns any elements that match
8 the provided regular expression.
12 grep(['aaa','bbb','ccc','aaaddd'], 'aaa')
20 if (arguments.size != 2) then
21 raise(Puppet::ParseError, "grep(): Wrong number of arguments "+
22 "given #{arguments.size} for 2")
26 pattern = Regexp.new(arguments[1])
33 # vim: set ts=2 sw=2 et :