Help with regular expression in python

Josh Benner sjbenner at gmail.com
Thu Aug 18 23:00:55 EDT 2011


On Thu, Aug 18, 2011 at 4:03 PM, Matt Funk <matze999 at gmail.com> wrote:

> Hi guys,
>
> thanks for the suggestions. I had tried the white space before as well (to
> no
> avail). So here is the expression i am using (based on suggestions), but
> still
> no success:
>
> instance_linetype_pattern_str =\
>        r'(([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+))?\s+){32}(.+)'
> instance_linetype_pattern = re.compile(instance_linetype_pattern_str)
> results = instance_linetype_pattern.findall(line)
> print "results: "; print results
>
>
> The match i get is:
> results:
> [('2.199000e+01 ', '2.199000', '.199000', 'e+01', ': (instance: 0)\t:\tsome
> description')]
>
>
> btw: The line to be matched (given below) is ONE line. There are no line
> breaks (even though my email client adds them).
>
>
> matt
>
>
>
If a group matches multiple times, only the last match is accessible.  The
matches returned represent the inner groupings of the last match found.

JB-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110818/07c33a29/attachment.html>


More information about the Python-list mailing list