[Tutor] Python Challenge - Riddle 2

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Tue May 10 21:03:36 CEST 2005


Alan Gauld wrote:

>>This matches '[A-Z]{3}[a-z]{1}[A-Z]{3}' 477 occurences...
> 
> 
> Doesn't the {3} mean a minimum of 3?

It's exactlu equivalent to [A-Z][A-Z][A-Z]

> I may be wrong, its not a feature I use much but I thought there was a
> gotcha with the {} notation that meant you had to provide a
> terminating
> character too?

If you want to prevent e.g. 'ABCDE' from matching as opposed to only 
'BCD', yes, you need some kind of terminator.

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven



More information about the Tutor mailing list