Rares Vernica wrote: > Isn't the following code supposed to return ('1994')? > > >>> re.search('(\d{4})?', '4 1994').groups() > (None,)
it's supposed to return the first thing that matches your pattern, which, in this case, is the empty string at the beginning of the target string. if you want to look for groups of four digits, remove the "?" </F> -- http://mail.python.org/mailman/listinfo/python-list