Regular Expression Meta-character Dollar "$"
What is Regular Expression meta-character Dollar "$"?
In Regular Expression, the dollar symbol "$" meta-character is used to find the matching character's from the end of a string.
$string = "This is a *";
if (preg_match("/*$/", $string))
echo "Pattern found at the end!";
echo "Pattern not found!";
Pattern found at the end!
In the above regex example the end of the string is matched for the character "*", and its matched.
print "content-type: text/htmlnn";
if ("This is a vessle" =~ m/el$/)
print "The regex pattern found at the end.!n";
print "The regex pattern not found!n";
The pattern not found!
In the above Regular Expression's example, the string is checked for the pattern "el" at the end of the string "vessel", but its unmatched as the last two characters are "el".