Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100720
| Path | csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!cleanfeed1-a.proxad.net!nnrp1-1.free.fr!not-for-mail |
|---|---|
| Date | Tue, 22 Dec 2015 11:56:48 +0100 |
| From | Thierry <no@mail.com> |
| Newsgroups | comp.lang.python |
| Subject | match point |
| Message-ID | <20151222115648.1222c992@eeearch> (permalink) |
| X-Newsreader | Claws Mail 3.13.0 (GTK+ 2.24.29; i686-pc-linux-gnu) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| Lines | 33 |
| Organization | Guest of ProXad - France |
| NNTP-Posting-Date | 22 Dec 2015 11:56:52 CET |
| NNTP-Posting-Host | 82.236.241.26 |
| X-Trace | 1450781812 news-1.free.fr 29517 82.236.241.26:33579 |
| X-Complaints-To | abuse@proxad.net |
| Xref | csiph.com comp.lang.python:100720 |
Show key headers only | View raw
Hi, Reading the docs about regular expressions, I am under the impression that calling re.match(pattern, string) is exactly the same as re.search(r'\A'+pattern, string) Same for fullmatch, that amounts to re.search(r'\A'+pattern+r'\Z', string) The docs devote a chapter to "6.2.5.3. search() vs. match()", but they only discuss how match() is different from search() with '^', completely eluding the case of search() with r'\A'. At first I thought those functions could have been introduced at a time when r'\A' and r'\Z' did not exist, but then I noticed that re.fullmatch is a recent addition (python 3.4) Surely the python devs are not cluttering the interface of the re module with useless functions for no reason, so what am I missing? Maybe re.match has an implementation that makes it more efficient? But then why would I ever use r'\A', since that anchor makes a pattern match in only a single position, and is therefore useless in functions like re.findall, re.finditer or re.split? Thanks, Thierry
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
match point Thierry <no@mail.com> - 2015-12-22 11:56 +0100 Re: match point Chris Angelico <rosuav@gmail.com> - 2015-12-22 22:07 +1100 Re: match point Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-22 13:01 +0100 Re: match point Thierry Closen <no@mail.com> - 2015-12-22 18:18 +0100
csiph-web