^ and $ matches only at the beginning or the end of a string.
/^def/ matches def only if these are the first three characters in the string.
/def$/ matches def only if these are the last three characters in the string.
combine ^ and $ to force matching of the entire string.
/^def$/ matches only if the string is def.
|