Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11847
| Date | 2011-08-19 09:20 -0600 |
|---|---|
| From | Matt Funk <matze999@gmail.com> |
| Subject | Re: Help with regular expression in python |
| References | <201108181349.54727.matze999@gmail.com> <201108181703.06278.matze999@gmail.com> <CAAAhF4FEg7QbzHnAJizEHxEVg6mZ4SsMRGWom-AhbTARyGXXQw@mail.gmail.com> <201108190809.17040.matze999@gmail.com> <CANy1k1iqJ-LqyLqik3bRTS9YdbgfHPL41f5b+JxXhikV3ttbVg@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.222.1313767221.27778.python-list@python.org> (permalink) |
Hi,
thanks for the suggestion. I guess i had found another way around the
problem as well. But i really wanted to match the line exactly and i
wanted to know why it doesn't work. That is less for the purpose of
getting the thing to work but more because it greatly annoys me off that
i can't figure out why it doesn't work. I.e. why the expression is not
matches {32} times. I just don't get it.
anyway, thanks though
matt
On 8/19/2011 8:41 AM, Jason Friedman wrote:
>> 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?
> $ python
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> data
> '1.002000e+01 2.037000e+01 2.128000e+01 1.908000e+01 1.871000e+01
> 1.914000e+01 2.007000e+01 1.664000e+01 2.204000e+01 2.109000e+01
> 2.209000e+01 2.376000e+01 2.158000e+01 2.177000e+01 2.152000e+01
> 2.267000e+01 1.084000e+01 1.671000e+01 1.888000e+01 1.854000e+01
> 2.064000e+01 2.000000e+01 2.200000e+01 2.139000e+01 2.137000e+01
> 2.178000e+01 2.179000e+01 2.123000e+01 2.201000e+01 2.150000e+01
> 2.150000e+01 2.199000e+01 : (instance: 0) : some
> description'
>>>> import re
>>>> re.findall(r"\d\.\d+e\+\d+", data)
> ['1.002000e+01', '2.037000e+01', '2.128000e+01', '1.908000e+01',
> '1.871000e+01', '1.914000e+01', '2.007000e+01', '1.664000e+01',
> '2.204000e+01', '2.109000e+01', '2.209000e+01', '2.376000e+01',
> '2.158000e+01', '2.177000e+01', '2.152000e+01', '2.267000e+01',
> '1.084000e+01', '1.671000e+01', '1.888000e+01', '1.854000e+01',
> '2.064000e+01', '2.000000e+01', '2.200000e+01', '2.139000e+01',
> '2.137000e+01', '2.178000e+01', '2.179000e+01', '2.123000e+01',
> '2.201000e+01', '2.150000e+01', '2.150000e+01', '2.199000e+01']
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Help with regular expression in python Matt Funk <matze999@gmail.com> - 2011-08-19 09:20 -0600
Re: Help with regular expression in python jmfauth <wxjmfauth@gmail.com> - 2011-08-19 08:50 -0700
Re: Help with regular expression in python Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-08-19 18:00 +0200
Re: Help with regular expression in python Matt Funk <matze999@gmail.com> - 2011-08-19 11:33 -0600
Re: Help with regular expression in python jmfauth <wxjmfauth@gmail.com> - 2011-08-19 11:40 -0700
Re: Help with regular expression in python Matt Funk <matze999@gmail.com> - 2011-08-19 15:21 -0600
Re: Help with regular expression in python "rurpy@yahoo.com" <rurpy@yahoo.com> - 2011-08-19 12:55 -0700
Re: Help with regular expression in python MRAB <python@mrabarnett.plus.com> - 2011-08-19 21:43 +0100
Re: Help with regular expression in python Carl Banks <pavlovevidence@gmail.com> - 2011-08-19 13:11 -0700
Re: Help with regular expression in python Matt Funk <matze999@gmail.com> - 2011-08-19 15:55 -0600
Re: Help with regular expression in python Vlastimil Brom <vlastimil.brom@gmail.com> - 2011-08-22 15:59 +0200
csiph-web