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


Groups > comp.lang.python > #74123

Re: How to write this repeat matching?

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 2014-07-07 10:18 -0600
Subject Re: How to write this repeat matching?
Newsgroups comp.lang.python
Message-ID <mailman.11599.1404749958.18130.python-list@python.org> (permalink)

Show all headers | 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