static public function lastPregErrorMessage()
    {
        $error = preg_last_error();
        $errorType = 'PCRE Engine error';

        switch ($error) {

            case PREG_BACKTRACK_LIMIT_ERROR:
                $errorType = "PCRE Engine backtrack limit exceeded";
                break;

            case PREG_RECURSION_LIMIT_ERROR:
                $errorType = "PCRE Engine recursion limit exceeded";
                break;

            case PREG_BAD_UTF8_ERROR:case PREG_BAD_UTF8_OFFSET_ERROR:
                $errorType = "PCRE Engine malformed UTF-8 error";
                break;
        }
        
        return $errorType;
    }