Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82113
| From | Jussi Piitulainen <jpiitula@ling.helsinki.fi> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Python re.search simple question |
| Date | 2014-12-08 09:13 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <qotoare396y.fsf@ruuvi.it.helsinki.fi> (permalink) |
| References | <mailman.16710.1418021565.18130.python-list@python.org> <qotsigq39g4.fsf@ruuvi.it.helsinki.fi> |
Jussi Piitulainen writes: > 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. On the other hand, the '---' *is* a typo, meant to be an ellipsis where I shortened your text. The shortened pattern would still match it, but that's an accident: '.' has a special meaning in a regexp. Sorry about that.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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