What is the potential issue with using the ereg() function in PHP for regular expressions?

The potential issue with using the ereg() function in PHP for regular expressions is that it is deprecated as of PHP 5.3.0 and removed in PHP 7.0.0. This means that using ereg() can lead to compatibility issues and errors in newer versions of PHP. To solve this problem, you should use the preg_match() function instead, which provides the same functionality but is the recommended approach for handling regular expressions in PHP.

// Using preg_match() to replace ereg()
$string = "Hello, World!";
$pattern = "/Hello/";
if (preg_match($pattern, $string)) {
    echo "Pattern found in string.";
} else {
    echo "Pattern not found in string.";
}