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


Groups > comp.lang.python > #100721

Re: match point

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: match point
Date 2015-12-22 22:07 +1100
Message-ID <mailman.55.1450782472.2237.python-list@python.org> (permalink)
References <20151222115648.1222c992@eeearch>

Show all headers | View raw


On Tue, Dec 22, 2015 at 9:56 PM, Thierry <no@mail.com> wrote:
> 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?

Much of the value of regular expressions is that they are NOT string
literals (just strings). Effectively, someone who has no authority to
change the code of the program can cause it to change from re.search
to re.match, simply by putting \A at the beginning of the search
string.

ChrisA

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


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