What are the potential pitfalls of using preg_match with UTF-8 and Western-ISO data in PHP?

When using preg_match with UTF-8 and Western-ISO data in PHP, potential pitfalls include incorrect matching due to character encoding differences. To solve this issue, you can use the 'u' modifier in the regular expression pattern to ensure proper handling of UTF-8 characters.

// Example code snippet with 'u' modifier for UTF-8 support
$pattern = '/\p{L}+/u';
$string = 'Café';
if (preg_match($pattern, $string, $matches)) {
    echo 'Match found: ' . $matches[0];
} else {
    echo 'No match found.';
}