Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'broken': 0.04; 'string.': 0.05; 'found,': 0.07; 'subject:bug': 0.07; 'suppose': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'translator': 0.09; "'}'": 0.16; 'expressions,': 0.16; 'hacked': 0.16; 'means.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:expression': 0.16; 'subject:possible': 0.16; 'wrote:': 0.18; 'written': 0.21; 'reset': 0.22; 'header:User-Agent:1': 0.23; 'integer': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'wonder': 0.29; "doesn't": 0.30; 'matching': 0.30; 'argue': 0.31; 'disable': 0.31; 'regular': 0.32; 'alone': 0.33; 'could': 0.34; 'but': 0.35; 'there': 0.35; 'surely': 0.36; 'subject:?': 0.36; 'should': 0.36; 'being': 0.38; 'problems': 0.38; 'ends': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'conversion': 0.61; 'new': 0.61; 'world': 0.66; 'believe': 0.68; 'received:109': 0.72; 'special': 0.74; 'ambiguous': 0.84; 'forced': 0.84; 'regexp': 0.84; 'silently': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robin Becker Subject: Re: possible bug in re expression? Date: Mon, 28 Apr 2014 10:47:54 +0100 References: <535A8DB5.4090109@chamonix.reportlab.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 109.174.168.73 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398678492 news.xs4all.nl 2938 [2001:888:2000:d::a6]:39741 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70672 On 25/04/2014 19:32, Terry Reedy wrote: .......... > I suppose that one could argue that '{' alone should be treated as special > immediately, and not just when a matching '}' is found, and should disable other > special meanings. I wonder what JS does if there is no matching '}'? > well in fact I suspect this is my mistranslation of the original new RegExp('.{1,' + (+size) + '}', 'g') my hacked up translator doesn't know what that means. I suspect that (+size) is an attempt to force size to an integer prior to it being forced to a string. I used to believe that conversion was always written 0-x, but experimentally (+"3") ends up as 3 not "3". Naively, I imagined that re would complain about ambiguous regular expressions, but in the regexp world n problems --> n+1 problems almost surely so I should have anticipated it :) Does this in fact that almost any broken regexp specification will silently fail because re will reset and consider any metacharacter as literal? -- Robin Becker