Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #11841 > unrolled thread

Re: Help with regular expression in python

Started byMatt Funk <matze999@gmail.com>
First post2011-08-19 08:09 -0600
Last post2011-08-19 08:09 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Help with regular expression in python Matt Funk <matze999@gmail.com> - 2011-08-19 08:09 -0600

#11841 — Re: Help with regular expression in python

FromMatt Funk <matze999@gmail.com>
Date2011-08-19 08:09 -0600
SubjectRe: Help with regular expression in python
Message-ID<mailman.219.1313762973.27778.python-list@python.org>
Hi Josh,
thanks for the reply. I am no expert so please bear with me:
I thought that the {32} was supposed to match the previous expression 32 
times?

So how can i have all matches accessible to me?

matt



On Thursday, August 18, 2011, Josh Benner wrote:
> On Thu, Aug 18, 2011 at 4:03 PM, Matt Funk <matze999@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-)

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web