Hi all, I'm experiencing problems with a regular expression and I can't figure out which words I use when googling. I read the python documentation for the re module multiple times now but still no idea what I'm doing wrong.
What I want to do: - Extract all digits (\d) in a string. - Digits are separated by space (\w) What my program does: - It extracts only the last digit. Here is my program: import re line = ' 1 2 3' regex = '^' + '(?:\s+(\d))*' + '$' match = re.match(regex, line) print "lastindex is: ",match.lastindex print "matches: ",match.group(1) Obviously I do not understand how (?:\s+(\d))* works in conjunction with ^ and $. Does anybody know how to transform this regex to get the result I want to have? fs -- http://mail.python.org/mailman/listinfo/python-list