What are some best practices for replacing deprecated ereg functions with preg_match in PHP?

When replacing deprecated ereg functions with preg_match in PHP, it is important to update the regular expressions to comply with the Perl-compatible regular expressions (PCRE) syntax used by preg_match. Additionally, make sure to use delimiters around the regular expression pattern and update any flags used in the ereg function to the appropriate modifiers in preg_match.

// Deprecated ereg function
if (ereg('pattern', $string)) {
    // Do something
}

// Updated preg_match function
if (preg_match('/pattern/', $string)) {
    // Do something
}