t437.py 311 B

1234567891011121314
  1. import re
  2. m = re.match('([0-9]+)([a-z]+)([A-Z]*)','345abu')
  3. print "\ngroup"
  4. print m.group() == '345abu'
  5. print m.group(0) == '345abu'
  6. print m.group(1) == '345'
  7. print m.group(2) == 'abu'
  8. print m.group(3) == ''
  9. print "\ngroups"
  10. print m.groups() == ('345','abu','')
  11. print m.groups('default') == ('345','abu','')