I thought I had a regular expression problem but I located the problem and its with the strtok, not my regex in above code--
I need to use strtok on a variable I have and break it on a "---", three dashes in a row, however, it seems to break on the last "-" in the string, even if it is only one dash.
$val1 = '---Invalid E-mail.';
$tok = strtok($val1,"---");
echo $tok;// prints -> Invalid E
it "should" be a emtpy variable.
I discovered a quick hack to fix this but I would like not to have to use this method. I have to pad the $val1 var with anything infront of the --- and it works right. As long as the "---" is not the first three characters in the variable it works right. However, I would like this to be able to work with a variable having "---" as the first three chars.. Any ideas?