preg_match error message
<pre><code>preg_match("/[\]/",'',$body);
</code></pre>

<p>I use preg_match but I have this error here</p>

<p>Compilation failed: missing terminating ] for character class at offset 3 </p>

<p>What's wrong here I can't find it</p>

<pre><code>$email_message = "Form details below.\n\n";

                    function clean_string($string) {
                        $bad = array("content-type","bcc:","to:","cc:","href");
                        return str_replace($bad,"",$string);
                    }

                    $email_message .= "Full Name: ".clean_string($_POST['full_name'])."\n";
                    $email_message .= "Email: ".clean_string($_POST['email'])."\n";
                    $email_message .= "Telephone number: ".clean_string($_POST['telephone'])."\n";
                    $email_message .= "Message: ".clean_string($_POST['comments'])."\n";


                    $mail             = new PHPMailer();
                    $body             = $email_message;
                    $body             = str_replace('\\', '', $body);

                    $mail-&gt;IsSMTP(); // telling the class to use SMTP
                    $mail-&gt;SMTPAuth   = true;                       // enable SMTP authentication
                    $mail-&gt;SMTPSecure = "ssl";                      // sets the prefix to the servier
                    $mail-&gt;Host       = "smtp.gmail.com";           // sets GMAIL as the SMTP server
                    $mail-&gt;Port       = 465;                        // set the SMTP port for the GMAIL server
                    $mail-&gt;Username   = "hanem@gmail.com";      // GMAIL username
                    $mail-&gt;Password   = "hinadk";       // GMAIL password

                    $mail-&gt;SetFrom('from-email@domain.com', 'First Last');

                    $mail-&gt;Subject    = "Imperia";

                    $mail-&gt;AltBody    = "To view the message, please use an HTML compatidble email viewer!"; // optional, comment out and test

                    $mail-&gt;MsgHTML($body);

                    $address = "hanem@gmail.com";
                    $mail-&gt;AddAddress($address, "To Name");

                    if(!$mail-&gt;Send()) {

                        echo "&lt;font color='red'&gt; Message error &lt;/font&gt;". $mail-&gt;ErrorInfo;
                    } else {
                        echo "&lt;font color='red'&gt; Message sent &lt;/font&gt;";
                    } 
</code></pre>

<p>there was    eregi_replace("[]",'',$body);</p>

<p>but I had a another error for that reason i change it to preg_match               </p>
