Doug Schwarz wrote:
> In article <[EMAIL PROTECTED]>,
>  Leif K-Brooks <[EMAIL PROTECTED]> wrote:
> 
> 
>>How do I make a regular expression which will match the same character
>>repeated one or more times, instead of matching repetitions of any
>>(possibly non-same) characters like ".+" does? In other words, I want a
>>pattern like this:
>>
>> >>> re.findall(".+", "foo") # not what I want
>> ['foo']
>> >>> re.findall("something", "foo") # what I want
>> ['f', 'oo']
> 
> 
> 
> How's this?
> 
>   >>> [x[0] for x in re.findall(r'((.)\2*)', 'abbcccddddcccbba')]
>   ['a', 'bb', 'ccc', 'dddd', 'ccc', 'bb', 'a']
> 

I think it's fantastic, but I'd be bound to say that given that it's the 
same as what I posted almost two days ago :-)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to