Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Michael Torrie Newsgroups: comp.lang.python Subject: Re: Regular expressions Date: Mon, 02 Nov 2015 20:51:15 -0700 Lines: 18 Message-ID: References: <662g3blobme52hfoududj27err185v2npm@4ax.com> <20151102204237.6a78abdf@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de qXAbtNqF4jaIm996ZLJDuwQfGhqIt0Xq4qcuDnzfxYag== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'else:': 0.03; 'indeed,': 0.09; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Regular': 0.16; 'subject:expressions': 0.16; 'wrote:': 0.16; 'people,': 0.20; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'regular': 0.29; 'chase': 0.29; "i'll": 0.33; 'message-id:@gmail.com': 0.34; 'quite': 0.35; 'sometimes': 0.35; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'end': 0.39; 'why': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'charset:windows-1252': 0.62; 'asterisk': 0.84; 'seymore4head': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <20151102204237.6a78abdf@bigbox.christie.dr> 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:98127 On 11/02/2015 07:42 PM, Tim Chase wrote: > On 2015-11-02 20:09, Seymore4Head wrote: >> How do I make a regular expression that returns true if the end of >> the line is an asterisk > > Why use a regular expression? > > if line[-1] == '*': > yep(line) > else: > nope(line) Indeed, sometimes Jamie Zawinski's is often quite appropriate: Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.