How to match any one uppercase character in python using Regular Expression?

PythonServer Side ProgrammingProgramming

The following code matches and prints any uppercase character in the given string using python regular expression as follows.

Example

import re
foo = 'MozamBiQuE'
match = re.findall(r'[A-Z]', foo)
print match

Output

This gives the output

['M', 'B', 'Q', 'E']

raja
Published on 02-Jan-2018 09:45:31
Advertisements