What are some potential pitfalls when using ereg in PHP for string manipulation?

One potential pitfall when using ereg in PHP for string manipulation is that it is a deprecated function as of PHP 5.3.0 and removed in PHP 7. To solve this issue, it is recommended to use the preg_match function instead, which provides similar functionality but with better performance and support for regular expressions.

// Using preg_match instead of ereg for string manipulation
$string = "Hello, World!";
$pattern = "/Hello/";

if (preg_match($pattern, $string)) {
    echo "Pattern found in string.";
} else {
    echo "Pattern not found in string.";
}