Some tasks on regexps in Python