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


Groups > comp.lang.python > #70672

Re: possible bug in re expression?

From Robin Becker <robin@reportlab.com>
Subject Re: possible bug in re expression?
Date 2014-04-28 10:47 +0100
References <535A8DB5.4090109@chamonix.reportlab.co.uk> <lje9ou$8do$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.9545.1398678492.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

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


Thread

Re: possible bug in re expression? Robin Becker <robin@reportlab.com> - 2014-04-28 10:47 +0100
  Re: possible bug in re expression? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-28 11:49 +0000
    Re: possible bug in re expression? Robin Becker <robin@reportlab.com> - 2014-04-28 14:06 +0100

csiph-web