Is there any way when using .net's Regex.Match() to work out if a string only contains capitals?
I am working in an application (so I don't have access to the code) which allows me to see if a field matches a certain regex pattern (using Regex.Match() behind the scene). So I want to use this to work out if the string is only capitals.
Thanks!
You can use the following regex. This will match any uppercase letter that has a lowercase variant.
^\p{Lu}+$
Or you can simply match only uppercase letter characters.
^[A-Z]+$
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