You have to do small change to RyanDev's solution, "fail" is there in both the case and if condition will return true for both strings so you have to find the index of | instead.
var strMessage = "Plcc-failed|Score-passed|bankruptcy-passed|Years in Business";
var intIndexLocation = strMessage.indexOf("|");
if (intIndexLocation >= 0)
alert("| is in the string");