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


Groups > comp.lang.python > #11847

Re: Help with regular expression in python

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <matze999@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python': 0.08; '>>>>': 0.09; 'matt': 0.09; 'suggestion.': 0.09; 'subject:python': 0.11; 'am,': 0.12; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '[gcc': 0.16; 'linux2': 0.16; 'subject:expression': 0.16; 'subject:regular': 0.16; 'wrote:': 0.16; 'subject:Help': 0.17; 'figure': 0.21; 'jason': 0.21; "doesn't": 0.22; 'header:In-Reply- To:1': 0.22; 'guess': 0.26; 'skip:[ 10': 0.27; 'work.': 0.27; 'problem': 0.28; 'import': 0.28; 'accessible': 0.29; 'matches': 0.29; 'match': 0.30; 'times.': 0.30; 'thanks': 0.30; "skip:' 10": 0.30; 'apr': 0.32; 'expression': 0.32; 'hi,': 0.32; 'me?': 0.32; 'it.': 0.33; "can't": 0.33; 'to:addr:python-list': 0.33; 'header :User-Agent:1': 0.34; 'message-id:@gmail.com': 0.34; 'supposed': 0.35; 'another': 0.37; 'but': 0.37; 'received:128': 0.38; 'some': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'i.e.': 0.39; 'getting': 0.39; 'subject:with': 0.39; 'data': 0.39; 'why': 0.39; 'to:addr:python.org': 0.39; 'greatly': 0.40; 'more': 0.60; 'expert': 0.62; 'bear': 0.80; 'me:': 0.84; 'data)': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=nmAiiTaG5DJgmUzHJUSTieftLI5TG9os/VvehIAGUVI=; b=B9PYApnLQUs0NMd7u44n/0OZ8p8TksyMhjY6lmb4Z8GFQo1aVNgSfvarn8FB/CO3DF l+LH+Ya7trHwN9r1MJwNoCkZbZq8Kq+Htr+6tsrNQU8IK2BZXI7g2tAUaRQs5jS3H4VP kFKINwysoEqmYfOmDP8oCYmW90vXxD1IYQ7YY=
Date Fri, 19 Aug 2011 09:20:16 -0600
From Matt Funk <matze999@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0
MIME-Version 1.0
To python-list@python.org
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>
In-Reply-To <CANy1k1iqJ-LqyLqik3bRTS9YdbgfHPL41f5b+JxXhikV3ttbVg@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.222.1313767221.27778.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1313767221 news.xs4all.nl 23965 [2001:888:2000:d::a6]:43235
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:11847

Show key headers only | View raw


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 | NextNext in thread | Find similar | Unroll thread


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