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


Groups > comp.lang.python > #82110

Re: Python re.search simple question

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Jussi Piitulainen <jpiitula@ling.helsinki.fi>
Newsgroups comp.lang.python
Subject Re: Python re.search simple question
Date 08 Dec 2014 09:08:27 +0200
Organization A noiseless patient Spider
Lines 13
Sender jpiitula@ruuvi.it.helsinki.fi
Message-ID <qotsigq39g4.fsf@ruuvi.it.helsinki.fi> (permalink)
References <mailman.16710.1418021565.18130.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx02.eternal-september.org; posting-host="da42b2e96e23bc971f06525f495b78b4"; logging-data="16631"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4/sudhOdSvWT4optVPEhiQUyN5/0HedA="
User-Agent Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Cancel-Lock sha1:7NQxlFUGi5eaxsli0XQkJ83RWBw=
Xref csiph.com comp.lang.python:82110

Show key headers only | View raw


Ganesh Pal writes:

> why is re.search failing in the below case  ??

Your pattern, '... level-based: [prev 0 , now 1]', matches a literal
string '--- level-based: ' followed by 'p', 'r', 'e', 'v', ' ', '0',
..., or '1', none of which is the '[' found in your text at that
position.

Are you sure you need a regexp?

If you are, make your pattern r'... \[prev 0 , now 1\]'. The 'r' is
not a typo.

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


Thread

Python re.search simple question Ganesh Pal <ganesh1pal@gmail.com> - 2014-12-08 12:22 +0530
  Re: Python re.search simple question Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-12-08 09:08 +0200
    Re: Python re.search simple question Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-12-08 09:13 +0200
  Re: Python re.search simple question Denis McMahon <denismfmcmahon@gmail.com> - 2014-12-09 00:31 +0000

csiph-web