Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; "shouldn't": 0.07; 'newline': 0.09; '>>>': 0.12; 'am,': 0.14; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'wrote:': 0.14; 'flag,': 0.16; 'header :In-Reply-To:1': 0.21; "aren't": 0.22; 'subject:problem': 0.22; 'match': 0.26; 'pass': 0.27; 'received:209.85.214': 0.28; 'instead': 0.29; "won't": 0.30; 'whitespace': 0.30; 'supposed': 0.31; "skip:' 10": 0.32; 'steven': 0.32; 'to:addr:python-list': 0.33; 'things': 0.33; 'thinking': 0.34; 'there': 0.35; 'header :User-Agent:1': 0.35; "d'aprano": 0.35; 'message-id:@gmail.com': 0.36; 'considered': 0.36; 'none': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.37; 'think': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'received:192': 0.38; 'unless': 0.39; 'received:209': 0.39; 'got': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; 'received:192.168.1': 0.40; '09:18': 0.84; 'match?': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=2YPZjpXccUyBj1uxmI8oFJvF7ormU0lhYbFg2U4ohgw=; b=jEeEW8zVP4aJ9QRPDhysz2tUF4h3HJN4M1idkfrmN8SdqVMgJcpDU6k0b3TrLqjx+4 6W5oSZK+F4WgEfO1dEm4/EeOXOZKAGPJ0IUcBbbXs+aIANdpQLTlcPbbDuDeLRiHvYVG ZrQmD2NkVpL2LuinP/ALQZxQppn+wjHqnFUgk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=C12O6/UF072QaB2kve7kUFoohlxkkc5gwH3e8lB5C9qnhKWXX+cV7oSo1HAO2wmlkd y0SjzJIptBIh340Sk8J0xrMG/CaqFnIgQoW5UD2aIsfYzLqrVyNI05nwFoJckcG0hTxc SETuAz7wDQ4U8M1xAGvewHdq8uzhglm1CcuJY= Date: Sun, 29 May 2011 09:35:19 -0500 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Weird problem matching with REs References: <4de2459b$0$29996$c3e8da3$5496439d@news.astraweb.com> <4de255a8$0$29996$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <4de255a8$0$29996$c3e8da3$5496439d@news.astraweb.com> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 18 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306679725 news.xs4all.nl 49044 [::ffff:82.94.164.166]:44051 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6542 On 2011.05.29 09:18 AM, Steven D'Aprano wrote: > >> What makes you think it shouldn't match? > > > > AFAIK, dots aren't supposed to match carriage returns or any other > > whitespace characters. > > They won't match *newlines* \n unless you pass the DOTALL flag, but they > do match whitespace: > > >>> re.search('abc.efg', '----abc efg----').group() > 'abc efg' > >>> re.search('abc.efg', '----abc\refg----').group() > 'abc\refg' > >>> re.search('abc.efg', '----abc\nefg----') is None > True I got things mixed up there (was thinking whitespace instead of newlines), but I thought dots aren't supposed to match '\r' (carriage return). Why is '\r' not considered a newline character?