What are the best practices for migrating from eregi() to preg_match in PHP to ensure functionality is maintained?

When migrating from eregi() to preg_match in PHP, it is important to update the regular expression syntax to comply with the PCRE (Perl Compatible Regular Expressions) format. Additionally, make sure to add delimiters to the regular expression and use the "i" modifier for case-insensitive matching. Testing the updated code thoroughly is crucial to ensure that the functionality is maintained.

// Before migration
if (eregi('pattern', $string)) {
    echo 'Match found';
}

// After migration
if (preg_match('/pattern/i', $string)) {
    echo 'Match found';
}