I know there is the [A-Z]
notation.. but I am not sure if [a-z]
is the same as \w
.
I'd like to match \w
, but only if it's uppercase.
This should include all the weird characters like Ę, Ą, Ś, Ć, Ź, Ż, Ś, Ł, Ó, Ń
.
You can use Unicode character properties. For example,
'/\p{Lu}/u'
Will match any uppercase letter.
\w
is equivalent of this character class:
[a-zA-Z0-9_]
If you want upper case unicode characters only then use this character class:
'/[\p{Lu}\p{N}_]/u'
This will match any one of:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With