For preg_* functions you need add only delimiters for example /
or #
or other, in start and end of the pattern.
Write this
if ( (!preg_match('/^[a-z\d-]+\.([a-z]{2,4})$/i', $domain)) && (!preg_match('/^[a-z\d-]+\.([a-z]{2,4})+\.([a-z]{2,4})$/', $domain)))
echo $arrErrors['domi'] = 'Domain name appears to be invalid.';
function makeClickableLinks($text)
{
$text = html_entity_decode($text);
$text = " ".$text;
$text = preg_replace('#(((f|ht){1}tp://)[-a-z\d@:%_\+.~\#?&//=]+)#',
'<a href="\\1" target=_blank>\\1</a>', $text);
$text = preg_replace('#(((f|ht){1}tps://)[-a-z\d@:%_\+.~\#?&//=]+)#',
'<a href="\\1" target=_blank>\\1</a>', $text);
$text = preg_replace('#([[:space:]()[{}])(www.[-a-z\d@:%_\+.~\#?&//=]+)#',
'\\1<a href="http://\\2" target=_blank>\\2</a>', $text);
$text = preg_replace('#([_\.\da-z-]+@([\da-z][\da-z-]+\.)+[a-z]{2,3})#',
'<a href="mailto:\\1" target=_blank>\\1</a>', $text);
return $text;
}