Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail 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; 'expressions': 0.07; 'python': 0.09; 'subject:string': 0.09; 'cc:addr:python-list': 0.10; 'subject:not': 0.11; '(the': 0.15; '10:00': 0.16; 'oct': 0.16; 'received:209.85.216.53': 0.16; 'sense,': 0.16; 'translation': 0.16; 'string': 0.17; 'wrote:': 0.17; 'thu,': 0.17; 'occurs': 0.22; 'cc:2**0': 0.23; 'academic': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'regular': 0.27; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'does': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'header:Received:5': 0.40; "else's": 0.84; 'mean.': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=UqLhgyOT8tu5JAx/3gnbHC2Yz0yy8y0ahywCm+RWj2A=; b=Jl2vyWNhPMNyFzjOnL6nOi9FoSnCHG07r/PF62K3mjrmqmhcoywSVa1oIdfJUDqKSQ c1kjMXBA6HkIjQfCdXewHpTARTs969mc80JdkYfgm8xEGTv+oaG5GMSQpVxzFjl25sbD EwSR/UykupPsSBF6hDIYIZvX3j7LTWEbXGm/cgpDZ2I03i2g5peL32cFuK7w0xmr4F7Y hBgSlI8NoMGK8q76q8/As+HcN4TPsQj3OG733sGF4qDTAlVPmgqt9V58Dfl/HE+rbjWQ COPZfkCAbKYoA405XGTKtlXyBolcraY7blgi1HrVz1Hk7MjBy7Vrb866RmGt4VQPfxGe pfug== MIME-Version: 1.0 In-Reply-To: References: <9eba5652-f814-41fa-83e4-460bca2be264@n16g2000yqi.googlegroups.com> <73f60cf3-d932-4366-a405-6767488560c6@q16g2000yqc.googlegroups.com> From: Devin Jeanpierre Date: Fri, 26 Oct 2012 01:08:06 -0400 Subject: Re: Quickie - Regexp for a string not at the beginning of the line To: Ed Morton Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351228128 news.xs4all.nl 6924 [2001:888:2000:d::a6]:46925 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32193 On Thu, Oct 25, 2012 at 10:00 PM, Ed Morton wrote: > Because there is no solution - there IS no _RE_ that will match a string not > at the beginning of a line. Depending on what the OP meant, the following would both work: - r"^(?!mystring)" (the string does not occur at the beginning) - r"(?!^)mystring" (the string occurs elsewhere than the beginning) [Someone else's interpretation] Both are "regular expressions" even in the academic sense, or else have a translation as regular expressions in the academic sense. They're also Python regexps. So I don't know what you mean. -- Devin