Re: non-terminating regex match

2008-04-03 Thread Gabriel Genellina
En Wed, 02 Apr 2008 13:01:59 -0300, Maurizio Vitale <[EMAIL PROTECTED]> escribió: > The intention is to match C++ identifiers, with or without namespace > qualification, with or without arguments (e.g. variables, functions and > macros). > The following should be accepted: > main > main(

Re: non-terminating regex match

2008-04-02 Thread Maurizio Vitale
MRAB <[EMAIL PROTECTED]> writes: > > I think the problem is with this bit: '(?:(?:::)?\w+)*'. The '::' is > optional and also in a repeated group, so if it tries to match, say, > 'abc' it can try and then backtrack all of these possibilities: abc, > ab c, a bc, a b c. The longer the string, the mo

Re: non-terminating regex match

2008-04-02 Thread Konstantin Veretennicov
On Wed, Apr 2, 2008 at 9:32 PM, Maurizio Vitale <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > > > On Wed, 02 Apr 2008 16:01:59 +, Maurizio Vitale wrote: > > > >> And yes, I'm a total beginner when it comes to Python, but it seems > >> very strange to me th

Re: non-terminating regex match

2008-04-02 Thread MRAB
On Apr 2, 5:01 pm, Maurizio Vitale <[EMAIL PROTECTED]> wrote: > Has to be something really stupid, but the following never finish > (running Python 2.5.1 (r251:54863, Jan 10 2008, 18:00:49) > [GCC 4.2.1 (SUSE Linux)] on linux2). > > The intention is to match C++ identifiers, with or without namespa

Re: non-terminating regex match

2008-04-02 Thread Maurizio Vitale
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Wed, 02 Apr 2008 16:01:59 +, Maurizio Vitale wrote: > >> And yes, I'm a total beginner when it comes to Python, but it seems >> very strange to me that a regex match on a finite length string >> doesn't terminate > > It does terminate,

Re: non-terminating regex match

2008-04-02 Thread Marc 'BlackJack' Rintsch
On Wed, 02 Apr 2008 16:01:59 +, Maurizio Vitale wrote: > And yes, I'm a total beginner when it comes to Python, but it seems > very strange to me that a regex match on a finite length string > doesn't terminate It does terminate, you just don't wait long enough. Try it with fewer characters

non-terminating regex match

2008-04-02 Thread Maurizio Vitale
Has to be something really stupid, but the following never finish (running Python 2.5.1 (r251:54863, Jan 10 2008, 18:00:49) [GCC 4.2.1 (SUSE Linux)] on linux2). The intention is to match C++ identifiers, with or without namespace qualification, with or without arguments (e.g. variables, function