python regex problem


In a text I have to find a word with this pattern :

one lowercase character then three capitalized characters then one lowercase, three capitalized and one lowercase.

I tried this one : ‘[a-z][A-Z]+[A-Z]+[A-Z]+[a-z]+[A-Z]+[A-Z]+[A-Z][a-z]’
But that don’t work.

Can any give me a hint ?


You seem to misunderstand the meaning of +. When you have understood, note that the + is greedy, it will swallow as many characters that match, so what you really want is:


or more succinctly


You might be interested in this site:

Python Regex Tool


Thank you.
It works but not perfect.

I try to solve this puzzle (re)
I get a hint that there are 10 “words” that match.
I get now only one.

So i have to puzzle how to solve that ?



found the problem.
I have this code :

import re

challenge = open('challenge2.txt')
regel =
uitkomst ='[a-z][A-Z]{3}[a-z][A-Z]{3}[a-z]', regel)

It’s only find the first occurence.

Anyone a tip how I can make it find and display everything

Wouldnt that the


like it is to seen in the “Python Regex Tool” (Thanks for the Link, Keny-Yap :slight_smile: )

(Because here it finds all occurences of the matching words according to your pattern)


Your right.

regex.findall did the trick of finding all the words.

Thanks all for the help.

Now trying to solve a pickle problem.