Ich brauche limit re.findall um die ersten 3 Treffer zu finden und dann zu stoppen.Finde die ersten x Treffer mit re.findall
zum Beispiel
text = 'some1 text2 bla3 regex4 python5'
re.findall(r'\d',text)
dann bekomme ich:
['1', '2', '3', '4', '5']
und ich will:
['1', '2', '3']
Sie können einen Blick hier: http://stackoverflow.com/questions/16235770/how-to- limit-regexs-findall-method –
oder besser hier: http://stackoverflow.com/questions/11902378/python-regular-expressions-limit-results –