What are the potential pitfalls of using regular expressions to filter for uppercase letters in PHP?

Using regular expressions to filter for uppercase letters in PHP can be inefficient and may not always give accurate results. It can be more resource-intensive compared to other methods, such as using built-in PHP functions like ctype_upper(). Additionally, regular expressions may not handle all edge cases or special characters correctly.

// Using ctype_upper() function to filter for uppercase letters in PHP
$string = "Hello World";
$uppercaseLetters = str_split($string);
$filteredUppercaseLetters = array_filter($uppercaseLetters, function($letter) {
    return ctype_upper($letter);
});

print_r($filteredUppercaseLetters);