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


Groups > comp.lang.python > #74123

Re: How to write this repeat matching?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'string.': 0.05; 'matches': 0.07; 'string': 0.09; "'a'": 0.09; 'explanation': 0.09; 'matched': 0.09; 'subject:How': 0.10; "'b'": 0.16; '2),': 0.16; 'wrote:': 0.18; 'string,': 0.24; 'mon,': 0.24; 'question': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'me?': 0.32; 'says': 0.33; 'url:python': 0.33; 'could': 0.34; 'problem': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'being': 0.38; 'to:addr:python-list': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'new': 0.61; 'finally': 0.65; 'jul': 0.74; 'repeat': 0.74; 'subject:this': 0.83; "'bc'": 0.84; 'clearly.': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=dAlEpY+x29LVMuZ2UaNRzLz58JvMN2XvpSZFCOOcoIs=; b=BzdSrMnZswKRLGDRCu1ogTpML8P7dALYo08rQnT0bWM9KdSS7AtQU0duUToXBIAFnw z0bMtBwKES7UWdf86l5ffSr2rGEPfo8m2exIywJxKSzGkOVdp2Sz8NO+fEgZw+2hAwRn DlusqJ8btLQ6tsi8tV82mZWzHI7/XeQfO6c4A9izUF9e3E9hyxYqrp8qhYxrUQ0KAyEE MCpR/w1i2rts2C9vWh64BB7hWl0Esr8bL7T5IpVNGP9wKv19WXt6TIBv0LGheeO6dSrq 1IyANsM3NlaihrcxA/DZY9j2ivxfQFkEaHSG8XY04ZJQ1KEJk2FmB+nuuRZjgcKqa2pE djKg==
X-Received by 10.66.119.39 with SMTP id kr7mr2730835pab.131.1404749954636; Mon, 07 Jul 2014 09:19:14 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <3840e655-b202-4a8d-b432-77c2d3cd58a4@googlegroups.com>
References <93a40570-00ed-4507-aa16-221d7e500468@googlegroups.com> <mailman.11559.1404675307.18130.python-list@python.org> <3840e655-b202-4a8d-b432-77c2d3cd58a4@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Mon, 7 Jul 2014 10:18:34 -0600
Subject Re: How to write this repeat matching?
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11599.1404749958.18130.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1404749958 news.xs4all.nl 2907 [2001:888:2000:d::a6]:53918
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74123

Show key headers only | View raw


On Mon, Jul 7, 2014 at 7:30 AM,  <rxjwg98@gmail.com> wrote:
> Because I am new to Python, I may not describe the question clearly. Could you
> read the original problem on web:
>
> https://docs.python.org/2/howto/regex.html
>
> It says that it gets 'abcb'. Could you explain it to me? Thanks again

The string being matched in the explanation at that link is 'abcbd',
not 'abcdb'. The 'a' in the pattern matches the 'a' in the string, the
'[bcd]*' in the pattern matches the 'bc' in the string (with a repeat
count of 2), and finally the 'b' in the pattern matches the 'b'
following that in the string.

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


Thread

How to write this repeat matching? rxjwg98@gmail.com - 2014-07-06 11:57 -0700
  Re: How to write this repeat matching? MRAB <python@mrabarnett.plus.com> - 2014-07-06 20:19 +0100
  Re: How to write this repeat matching? Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-06 13:26 -0600
    Re: How to write this repeat matching? rxjwg98@gmail.com - 2014-07-07 06:30 -0700
      Re: How to write this repeat matching? Anssi Saari <as@sci.fi> - 2014-07-07 18:48 +0300
      Re: How to write this repeat matching? Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-07 10:18 -0600

csiph-web