# 0909.py import re testo='era [uno] e [due]' ris=re.search('\[(.*)\]',testo) if ris: print (ris.group(1)) # uno] e [due ris=re.search('\[(.*?)\]',testo) if ris: print (ris.group(1)) # uno ####################################### testo='babaaaaa' ris=re.search('(a+)',testo) if ris: print (ris.group(1)) # a