public static function safe(string $string, string $regex = self::SAFE)
    {
        if (preg_match($regex, $string)) :
            return $string;
        else :
            return false;
        endif;
    }
public static function safe(string $string, string $regex = self::SAFE)
    {
        if (preg_match($regex, $string)) :
            return $string;
        else :
            return false;
        endif;
    }
public static function safe ( string $ string , string $ regex = self :: SAFE ) { if ( preg_match ( $ regex , $ string ) ) : return $ string ; else : return false ; endif ; }
Determine if a string contains any "bad" characters.

It works by checking for the presence of ONLY "good"
characters; not the presense of "bad" characters,
which should make it more difficult to trick.

@param string $string    The string to check.
@param string $regex     (optional) Regex defining "safe" characters.
@return string|bool      Return $string if save, bool false if not.
Determine if a string contains any bad characters .