Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'below)': 0.05; 'received:localnet': 0.07; 'suggestions.': 0.07; '(given': 0.09; 'matt': 0.09; 'subject:python': 0.11; 'btw:': 0.16; 'guys,': 0.16; 'matched': 0.16; 'skip:r 50': 0.16; 'subject:expression': 0.16; 'subject:regular': 0.16; 'success:': 0.16; 'wrote:': 0.16; 'subject:Help': 0.17; 'header:In-Reply-To:1': 0.22; 'breaks': 0.23; 'pm,': 0.24; 'aug': 0.24; 'times,': 0.24; 'tried': 0.26; 'skip:[ 10': 0.27; 'charset:iso-8859-15': 0.28; 'thu,': 0.28; '(even': 0.29; 'accessible': 0.29; 'matches': 0.29; 'print': 0.29; 'match': 0.30; 'thanks': 0.30; 'adds': 0.32; 'expression': 0.32; 'me?': 0.32; 'there': 0.33; 'to:addr:python-list': 0.33; 'header :User-Agent:1': 0.34; 'message-id:@gmail.com': 0.34; 'supposed': 0.35; '(to': 0.37; 'skip:i 30': 0.37; 'thursday,': 0.37; 'using': 0.37; 'but': 0.37; 'received:128': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'returned': 0.39; 'client': 0.39; 'represent': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; 'results': 0.61; 'header:Message- Id:1': 0.61; 'expert': 0.62; 'here': 0.65; 'august': 0.70; 'header :Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.71; 'reply- to:addr:gmail.com': 0.78; 'bear': 0.80; '(based': 0.84; 'funk': 0.84; 'me:': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=9cPH06USEbZ4wXEBRJtHPSBhP49Bovrp2RZAsJSwm2E=; b=JfXHbaXGge6TI/sDaER+FQgf843nq//Wu0qmpCtd4g6DGaO2EnR68qugUjQ03Zbq1b SlvE90TGas4+skjJ6AqejpDKz00QrYkJBCUiswByWVBpdnstpqGT8MrNIYbNF6Oy/cH8 RUq0SGqHOljDW83Aq0w5XGl42Ayjh+980Evfk= From: Matt Funk To: python-list@python.org Subject: Re: Help with regular expression in python Date: Fri, 19 Aug 2011 08:09:16 -0600 User-Agent: KMail/1.13.6 (Linux/2.6.38-10-server; KDE/4.6.2; x86_64; ; ) References: <201108181349.54727.matze999@gmail.com> <201108181703.06278.matze999@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313762973 news.xs4all.nl 23887 [2001:888:2000:d::a6]:50504 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11841 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 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-)