I am trying to find a regex-solution for finding all words with max 4. letters and at least 1 capital letter:
Examples of positive matches:
A, Ab, AbC, ABC, Abcd, bACD, aBCd, abcD
Examples of negative matches:
abcd
Do you know if this is possible with regex?
I started off with something like this:
match = re.findall(r"[a-zA-Z]{1,4}", string)
but how do I eliminate the case of only small letters?
EDIT: I would like to find these patterns within a string of words such as this:
"in this sentence, we want to find Abcd and Hi but not abcd and not abcdefgHI"
Result: ["Abcd", "Hi"]