Regular Expressions
Variable interpolation
You may write variable names inside a regular expression, and
they will be interpolated into their values.
Example
$name = "Danny";
if ($text =~ /$name is here/) { }
# same as:
# if ($text =~ /Danny is here/) { }
Meta-characters
As we have seen before, the following characters have
special meaning inside regular expressions.
If you want to use them literally, add a backslash before them.
Example
To match "5*(12+7)=45. right?"
write:
$text =~ /5\*\(12\+7\)=45\. right\?/;
Note:
Closing HTML tags require a backlash inside regular expressions:
$html =~ /<H1>.*<\/H1>/;
Table of Contents.