What is the correct way to include an email domain like @mueller.de in the list of words to check for in PHP using preg_match?

When including an email domain like @mueller.de in the list of words to check for in PHP using preg_match, it is important to escape the dot (.) character in the domain name as it is a special character in regular expressions. This can be done by using the preg_quote function to escape any special characters in the domain name before including it in the regular expression pattern.

$domain = 'mueller.de';
$escaped_domain = preg_quote($domain, '/');
$pattern = '/\b' . $escaped_domain . '\b/';

$word_to_check = 'example@mueller.de';

if (preg_match($pattern, $word_to_check)) {
    echo 'Domain found in email address.';
} else {
    echo 'Domain not found in email address.';
}