Add regex_escape() TT function

beta
Vitaliy Filippov 2019-08-21 15:29:09 +03:00
parent ae264bdf2d
commit bbcb30140c
1 changed files with 15 additions and 0 deletions

View File

@ -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 <select>
# html_select(name, <selected value>, <values>, [<value names>], [<attr_hash>])
# <values> may be one of: