diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 2555e2144..adea2e86a 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -956,6 +956,21 @@ sub create # html_quote in the form of a function html => \&html_quote, + # escape regular expression characters + regex_escape => sub + { + my ($s) = @_; + return "\Q$s\E"; + }, + + # escape regular expression replacement characters + replacement_escape => sub + { + my ($s) = @_; + $s =~ s/([\\\$])/\\$1/gso; + return $s; + }, + # HTML