Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: match point Date: Tue, 22 Dec 2015 22:07:43 +1100 Lines: 13 Message-ID: References: <20151222115648.1222c992@eeearch> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de dHu/vZfxK4HzAZGRTiVOvwMwZxoGRT3X4T377QdBobgQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'position,': 0.04; 'string.': 0.04; 'expressions': 0.07; 'cc:addr:python-list': 0.09; '22,': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'literals': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'useless': 0.16; 'wrote:': 0.16; 'string': 0.17; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'dec': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'regular': 0.29; 'code': 0.30; 'putting': 0.30; 'maybe': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'beginning': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'someone': 0.38; 'why': 0.39; 'ever': 0.60; 'more': 0.63; 'therefore': 0.67; 'chrisa': 0.84; 'effectively,': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=i/dRX+BAEm346DY9kVxPLlcI9jFW2ASrOWheoNioe18=; b=OnzPhvQOgZT0abKBxRit+wd4noew7dMWvnuvEuAItiNnstRjva0QxVDl8Wjzcs/DAa N+a3ijLXAm1jRkNUsGm0NKlxWCPvVzXZWx3E0ogC4/fBjqmR+Bm17R6bG8t2CIkB/ZJ4 /n6RQyVy0Aq4iOAmmBuIYOHyPPF6m1eFk3uCImW7VlL8MJDhdKXJTsL5prEJQBLpYGBN xZ7hKajEryDwtQkDu2llg8P3JyXH4k1UII+tjtiQuS/TN/EnSYprJt38kjcNXxnhwam0 Lbeh2AIIge7+3ZL5CuilfRJ/gIdgEb+kO4Et45QRL8dXme7xXOAuyuRCDtp/Cyp9y+k/ +qPQ== X-Received: by 10.107.163.146 with SMTP id m140mr22786082ioe.19.1450782463893; Tue, 22 Dec 2015 03:07:43 -0800 (PST) In-Reply-To: <20151222115648.1222c992@eeearch> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100721 On Tue, Dec 22, 2015 at 9:56 PM, Thierry 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