Sha256: 47e0a2bf341358b211c998c04f5571f7d39f75c13ce1ce54ba6dfd0feeb18460

Contents?: true

Size: 821 Bytes

Versions: 50

Compression:

Stored size: 821 Bytes

Contents

Puppet::Parser::Functions::newfunction(
  :match,
  :arity => 2,
  :doc => <<-DOC
Returns the match result of matching a String or Array[String] with one of:

* Regexp
* String - transformed to a Regexp
* Pattern type
* Regexp type

Returns An Array with the entire match at index 0, and each subsequent submatch at index 1-n.
If there was no match `undef` is returned. If the value to match is an Array, a array
with mapped match results is returned.

Example matching:

  "abc123".match(/([a-z]+)[1-9]+/)    # => ["abc"]
  "abc123".match(/([a-z]+)([1-9]+)/)  # => ["abc", "123"]

See the documentation for "The Puppet Type System" for more information about types.

- since 3.7.0
- note requires future parser
DOC
) do |args|
  function_fail(["match() is only available when parser/evaluator future is in effect"])
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
puppet-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/parser/functions/match.rb
puppet-3.8.7 lib/puppet/parser/functions/match.rb
puppet-3.8.7-x86-mingw32 lib/puppet/parser/functions/match.rb
puppet-3.8.7-x64-mingw32 lib/puppet/parser/functions/match.rb
puppet-3.8.6 lib/puppet/parser/functions/match.rb
puppet-3.8.6-x86-mingw32 lib/puppet/parser/functions/match.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/parser/functions/match.rb
puppet-3.8.6-x64-mingw32 lib/puppet/parser/functions/match.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/parser/functions/match.rb
puppet-3.8.5 lib/puppet/parser/functions/match.rb
puppet-3.8.5-x86-mingw32 lib/puppet/parser/functions/match.rb
puppet-3.8.5-x64-mingw32 lib/puppet/parser/functions/match.rb
puppet-3.8.4 lib/puppet/parser/functions/match.rb
puppet-3.8.4-x86-mingw32 lib/puppet/parser/functions/match.rb
puppet-3.8.4-x64-mingw32 lib/puppet/parser/functions/match.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/parser/functions/match.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/parser/functions/match.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/parser/functions/match.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/parser/functions/match.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/parser/functions/match.rb