[L3] regex help?

515 views
Skip to first unread message

Angela

unread,
Apr 17, 2022, 8:33:22 AM4/17/22
to Python Challenge
From the clue i believe i should be looking for a pattern = 3 uppercase letters followed by 1 lower case letter, followed by 3 upper case letters. I'm using regex to find this pattern: 

matcher= re.compile(r'([A-Z])\1{2}([a-z])([A-Z])\1{2}')

but it's not pulling anything. What am I doing wrong? 

TIA!!! 

quasarchaser

unread,
Apr 23, 2022, 8:43:56 AM4/23/22
to Python Challenge
I'm not quite sure but try {3} instead of {2}. Also, keep in mind that the pattern is ONLY 3 uppercase letters followed by a lowercase letter followed by ONLY 3 uppercase letters.  

Hassan Wazni

unread,
Aug 3, 2022, 3:50:51 AM8/3/22
to Python Challenge
print(re.findall(r"[A-Z]{3}[a-z]{1}[A-Z]{3}",strings))
Reply all
Reply to author
Forward
0 new messages