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


Groups > comp.lang.python > #11801

Help with regular expression in python

X-FeedAbuse http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!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.033
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'received:localnet': 0.07; 'expressions.': 0.09; 'matt': 0.09; 'subject:python': 0.11; "doesn't.": 0.16; 'offense': 0.16; 'shed': 0.16; 'subject:expression': 0.16; 'subject:regular': 0.16; 'subject:Help': 0.17; 'figure': 0.21; "doesn't": 0.22; "skip:' 40": 0.23; '(in': 0.26; 'work.': 0.27; 'scientific': 0.28; 'problem': 0.28; 'matches': 0.29; 'example': 0.30; 'match': 0.30; 'times.': 0.30; 'line:': 0.30; 'thanks': 0.30; 'expression': 0.32; 'go.': 0.32; 'hi,': 0.32; 'does': 0.32; 'it.': 0.33; "can't": 0.33; 'there': 0.33; 'to:addr:python-list': 0.33; 'light': 0.34; 'however,': 0.34; 'someone': 0.34; 'header:User-Agent:1': 0.34; 'message-id:@gmail.com': 0.34; 'quite': 0.34; 'list.': 0.35; 'supposed': 0.35; 'regular': 0.35; 'charset:us-ascii': 0.36; 'question': 0.36; 'using': 0.37; 'received:128': 0.38; 'some': 0.38; 'received:google.com': 0.38; 'should': 0.38; 'subject:with': 0.39; 'format.': 0.39; 'why': 0.39; 'to:addr:python.org': 0.39; 'received:74.125': 0.39; 'description': 0.39; "i'd": 0.40; 'where': 0.40; 'subject': 0.61; 'header:Message-Id:1': 0.61; 'vary': 0.64; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.71; 'reply-to:addr:gmail.com': 0.78
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:mime-version:content-type :content-transfer-encoding:message-id; bh=gU5sKosglgENkGNiYOvv2TwdeSZ64e8pNE5WOHTisq4=; b=G/coXm/g0dF6MvMAK1gTakaFagPYVt3lFlQcpXFioT5pHRKR6NBY4ngSAPw4TeAnjO 9gh1bxHm7Cxx2rTqqRzvUrZAXbAcm6P5Az8+LXt2TMMbr3Be5TZMd4Z1+3cXdLwGoQWE /NdSHm/rzNP1kMQ0iyM79LQv6qXIktTa88kvM=
From Matt Funk <matze999@gmail.com>
To python-list@python.org
Subject Help with regular expression in python
Date Thu, 18 Aug 2011 13:49:54 -0600
User-Agent KMail/1.13.6 (Linux/2.6.38-10-server; KDE/4.6.2; x86_64; ; )
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To matze999@gmail.com
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.191.1313697016.27778.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1313697016 news.xs4all.nl 23845 [2001:888:2000:d::a6]:56202
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:11801

Show key headers only | View raw


Hi,
i am sorry if this doesn't quite match the subject of the list. If someone 
takes offense please point me to where this question should go. Anyway, i have 
a problem using regular expressions. I would like to match the line:

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

The number of floats can vary (in this example there are 32). So what i thought 
i'd do is the following:
instance_linetype_pattern_str = '([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)
{32}'
instance_linetype_pattern = re.compile(instance_linetype_pattern_str)
Basically the expression in the first major set of paranthesis matches a 
scientific number format. The '{32}' is supposed to match the previous 32 
times. However, it doesn't. I  can't figure out why this does not work. I'd 
really like to understand it if someone can shed light on it.

thanks
matt

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Help with regular expression in python Matt Funk <matze999@gmail.com> - 2011-08-18 13:49 -0600
  Re: Help with regular expression in python John Gordon <gordon@panix.com> - 2011-08-18 20:00 +0000

csiph-web