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


Groups > comp.lang.python > #18778

Re: Unclear about verbose regex syntax (excaping whitespace)

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'suppose': 0.05; 'ignored': 0.07; 'backslash': 0.09; 'case.': 0.15; '-tkc': 0.16; 'backslash,': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'ignored,': 0.16; 'latter,': 0.16; 'message- id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'roy': 0.16; 'subject:regex': 0.16; 'subject:syntax': 0.16; 'unescaped': 0.16; 'wrote:': 0.18; 'say,': 0.19; 'header:In-Reply- To:1': 0.22; 'thus': 0.23; 'cc:2**0': 0.24; 'suspect': 0.24; 'second': 0.29; 'pattern': 0.30; 'does': 0.32; 'header:User- Agent:1': 0.33; 'to:addr:python-list': 0.34; 'apply': 0.35; 'but': 0.37; 'except': 0.37; 'could': 0.37; 'somewhat': 0.38; 'subject: (': 0.40; "it's": 0.40; 'to:addr:python.org': 0.40; 'within': 0.60; 'your': 0.61; 'ambiguous.': 0.84; 'unclear': 0.91
Date Tue, 10 Jan 2012 11:34:36 -0600
From Tim Chase <python.list@tim.thechases.com>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16
MIME-Version 1.0
To python-list@python.org
Subject Re: Unclear about verbose regex syntax (excaping whitespace)
References <27946490.520.1326214183718.JavaMail.geo-discussion-forums@vbnm18>
In-Reply-To <27946490.520.1326214183718.JavaMail.geo-discussion-forums@vbnm18>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Source
X-Source-Args
X-Source-Dir
Cc Roy Smith <roy@panix.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4607.1326220199.27778.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326220199 news.xs4all.nl 6849 [2001:888:2000:d::a6]:51693
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18778

Show key headers only | View raw


On 01/10/12 10:49, Roy Smith wrote:
> The docs for re.VERBOSE say, "Whitespace within the pattern is
> ignored, except when [...] preceded by an unescaped
> backslash".  It's unclear exactly what that means.  If my
> pattern is:
>
> <backslash><space><space>
>
> is the second space considered to be preceded by a backslash,
> and thus taken literally, or does the backslash only apply to
> the first<space>?  I suspect the latter, but it's somewhat
> ambiguous.

You're right (easily testable) in your suspicions that the second 
space is ignored in this case.  I suppose the documentation could 
be tweaked to read "immediately preceded".

-tkc



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


Thread

Unclear about verbose regex syntax (excaping whitespace) Roy Smith <roy@panix.com> - 2012-01-10 08:49 -0800
  Re: Unclear about verbose regex syntax (excaping whitespace) Tim Chase <python.list@tim.thechases.com> - 2012-01-10 11:34 -0600

csiph-web