in reply to Problem using value of variable in a regular expression

change your double quotes to single:
$failmsg = '\*E';

Or, double up the backslashes

$failmsg = "\\*E";