How can one handle special characters like umlauts in regex patterns in PHP?

Special characters like umlauts (e.g., ä, ö, ü) can be handled in regex patterns in PHP by using the Unicode modifier "u". This modifier allows the regex engine to properly interpret and match Unicode characters, including special characters like umlauts. By adding the "u" modifier to the regex pattern, PHP will correctly handle special characters in the string.

$pattern = '/ä|ö|ü/u';
$string = 'München';
if (preg_match($pattern, $string)) {
    echo 'Found umlaut in string';
} else {
    echo 'Umlaut not found in string';
}