What are some common pitfalls to avoid when using regular expressions in PHP to manipulate text containing email addresses?

A common pitfall when using regular expressions in PHP to manipulate text containing email addresses is not properly escaping special characters, such as the dot (.), which has a special meaning in regular expressions. To avoid this issue, it's important to use the preg_quote() function to escape any special characters before using them in the regular expression pattern. Example PHP code snippet:

$text = "Send an email to user@example.com for more information.";
$pattern = '/\b' . preg_quote('user@example.com', '/') . '\b/';
$replacement = 'email@example.com';
$newText = preg_replace($pattern, $replacement, $text);

echo $newText;