Fixed syntax errors, preg_match rewrite