user1876508 - 1 year ago 73
Python Question

# How to use regular expressions in python to search for all capitalization combinations

In python, how can I make a regular expression that would match all capitalization combinations of a word, without formatting the data before hand. For example, let's say I want to match lines in a file that match the word name, however it is capitalized. That is, name could look like any of the following

Name
nAMe
NAme


etc.

Make sure to pass the re.IGNORECASE option when calling your match, find or search.
import re