On Thu, Apr 19, 2012 at 10:02 PM, Sania <fantasyblu...@gmail.com> wrote: > So now my regex is > > dead=re.match(r".*death toll.{0,20}(\d[,\d\.]*)", text) > > But I only find 7 not 657. How is it that the group is only matching > the last digit? The whole thing is parenthesis not just the last > part. ?
Your problem is still that the early part is greedy. Either switch to the non-greedy version or use something other than . such that it can't match what you don't want it to match - \D will serve here. (Both suggestions have been made already.) You don't need {0,20} that way. ChrisA -- http://mail.python.org/mailman/listinfo/python-list