Re: Why do look-ahead and look-behind have to be fixed-width patterns?

2005-01-28 Thread Diez B. Roggisch
> but I don't understand why regex look-behinds (and look-aheads) have to be > fixed-width patterns. > > i'm getting the impression that it's supposed to make searching > exponentially slower otherwise That's because of the underlying theory of regular expressions. They are modelled using so call

Re: Why do look-ahead and look-behind have to be fixed-width patterns?

2005-01-27 Thread Steven Bethard
John Machin wrote: To grab the text after the 2nd colon (if indeed there are two or more), it's much simpler to do this: import re q = re.compile(r'.*?:.*?:(.*)').search def grab(s): ...m = q(s) ...if m: ... print m.group(1) ...else: ... print 'not found!' ... grab('') not f

Re: Why do look-ahead and look-behind have to be fixed-width patterns?

2005-01-27 Thread John Machin
inhahe wrote: > Hi i'm a newbie at this and probably always will be, so don't be surprised > if I don't know what i'm talking about. > > but I don't understand why regex look-behinds (and look-aheads) have to be > fixed-width patterns. > > i'm getting the impression that it's supposed to make sear

Why do look-ahead and look-behind have to be fixed-width patterns?

2005-01-27 Thread inhahe
Hi i'm a newbie at this and probably always will be, so don't be surprised if I don't know what i'm talking about. but I don't understand why regex look-behinds (and look-aheads) have to be fixed-width patterns. i'm getting the impression that it's supposed to make searching exponentially slower