Justin Azoff wrote:
> John Salerno wrote:
>> Ok, I'm stuck on another Python challenge question. Apparently what you
>> have to do is search through a huge group of characters and find a
>> single lowercase character that has exactly three uppercase characters
>> on either side of it. Here's what I have so far:
>>
>> pattern = '([a-z][A-Z]{3}[a-z][A-Z]{3}[a-z])+'
>> print re.search(pattern, mess).groups()
>>
>> Not sure if 'groups' is necessary or not.
>>
>> Anyway, this returns one matching string, but when I put this letter in
>> as the solution to the problem, I get a message saying "yes, but there
>> are more", so assuming this means that there is more than one character
>> with three caps on either side, is my RE written correctly to find them
>> all? I didn't have the parentheses or + sign at first, but I added them
>> to find all the possible matches, but still only one comes up.
>>
>> Thanks.
> 
> I don't believe you _need_ the parenthesis or the + in that usage...
> 
> Have a look at http://docs.python.org/lib/node115.html
> 
> It should be obvious which method you need to use to "find them all"
> 

But would findall return this match: aMNHiRFLoDLFb  ??

There are actually two matches there, but they overlap. So how would 
your write an RE that catches them both?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to