summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/re_escape.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/re_escape.rb')
-rw-r--r--lib/puppet/parser/functions/re_escape.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/re_escape.rb b/lib/puppet/parser/functions/re_escape.rb
new file mode 100644
index 0000000..7bee90a
--- /dev/null
+++ b/lib/puppet/parser/functions/re_escape.rb
@@ -0,0 +1,7 @@
+# apply ruby regexp escaping to a string
+module Puppet::Parser::Functions
+ newfunction(:re_escape, :type => :rvalue) do |args|
+ Regexp.escape(args[0])
+ end
+end
+