I have a string. For now lets go with $string="mFN6jTPx?!". I would like to be able to count how many capital letters there are. I have tried using ($string -cmatch '[A-Z]').length but that only comes back as 1 given it brings back true or false value. I have also tried using ($string -creplace '^[A-Z]') but it just brings back mFN6jTPx?! so doing length check will not get me the correct number. Any ideas?
Add a comment
|