Rares Vernica wrote: > Hi, > > Isn't the following code supposed to return ('1994')? > > >>> re.search('(\d{4})?', '4 1994').groups() > (None,) > > Thanks, > Ray
The ? is allowing it to not match before it finds the 1994. Note: py> re.search('(\d{4})?', '1994 4').groups() ('1994',) James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list