preg_match使用变量?

here is what i want to try to do. I want an easy way to just add in new emails without having to have my client to have to touch the main code.

$list= 'gmail|yahoo|aol'; 


$banned = '\b[\w\.-]+@((?!'.$list.').)[\w\.-]+\.\w{2,4}\b';

if ( isset($data['email']) && !preg_match($banned, $data['email']) )
{}

or perhaps. do an include that points to a text file? with the domains listed inside?


updated

here is my code..

//Banned Domains
    $banned = 'mailexpire|spamtrail|0815';
    //


    //Emails    
    $email_list = '/^[\w.-]+@((?!'.$banned.').)[\w.-]+\.\w{2,4}$/';             
    if ( isset($data['email']) && preg_match($email_list, $data['email']) )
    {
        $response->addError('Email Addresses from this domain are not allowed, Please try a different email address', 'email');
    }

    else if ( isset($data['email']) && !preg_match($email_list, $data['email']) )
    {
        $query = SK_MySQL::placeholder("SELECT COUNT(`profile_id`) FROM `".TBL_PROFILE."` WHERE `email`='?'",$data['email']);
        if (SK_MySQL::query($query)->fetch_cell()) {
            $error_msg = SK_Language::text('%forms._fields.email.errors.already_exists');
            $response->addError($error_msg,'email');
        }
    }
    //END

for some reason.. its not catching the domains?

The problem is that you have forgotten to put pattern delimiters:

$banned = '/^[\w.-]+@((?!' . $list . ').)[\w.-]+\.\w{2,4}$/';