in reply to Problem using value of variable in a regular expression
$failmsg = '\*E'; [download]
Or, double up the backslashes
$failmsg = "\\*E"; [download]