quotemeta() Function of Regular Expression in Perl

What is quotemeta() Function of regular expression in Perl?
How to escape the metacharacters in string?


The quotemeta() function is used to escape all the meta characters in a string.



In the above syntax, quotemeta() function takes a "string" as an argument.

Example to escape metacharacters in string:

#! C:programfilesperlbinperl
print "content-type: text/htmlnn";
print quotemeta("BC*[.]*");
Result :


In the above example the metacharacters in the string "*, , [ , .,]" are escaped using the quotemeta() function.

Ask Questions

Ask Question