Hello world,

I am looking at a certain function in php, from the IMP mail reader (Horde Groupware). I have played a bit with it, but I hate the idea of having several lines of:

 $vdomain = preg_replace('|^STRING\.|i', '', $vdomain);


<CUT>

if (!function_exists('_imp_hook_vinfo')) {
    function _imp_hook_vinfo($type = 'username')
    {
        $vdomain = getenv('HTTP_HOST');
        $vdomain = preg_replace('|^webmail\.|i', '', $vdomain);
        $vdomain = preg_replace('|^gw\.|i', '', $vdomain);
        $vdomain = preg_replace('|^mail\.|i', '', $vdomain);
        $vdomain = preg_replace('|^(webmail|gw|mail|otherstring)\.|i','', $vdomain);
        $vdomain = String::lower($vdomain);

        if ($type == 'username') {
             return preg_replace('|\.|', '.', $_SESSION['imp']['user'] . '@' . $vdomain);
        } elseif ($type == 'vdomain') {
            return $vdomain;
        } else {
            return PEAR::raiseError('invalid type: ' . $type);
        }
    }
}
</CUT>

Now, instead of having several lines to match and replace a certain string with an empty string, I am thinking a single line regex would do, and it should, no??
I have tried the following:

$vdomain = preg_replace('|^(webmail|gw|mail|otherstring)\.|i','', $vdomain);


But I end up with an error: Unknown modifier 'g' in hooks.php.

Is it because I am using mixed up string separator?


--
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254733744121/+254722743223
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Damn!!