Why do look-ahead and look-behind have to be fixed-width patterns?
From: inhahe (iseestars_at_gate.net)
Date: 01/28/05
- Next message: Jeremy Jones: "IPython Article on O'Reilly's ONLamp site"
- Previous message: Tom Willis: "win32com/makepy question"
- Next in thread: John Machin: "Re: Why do look-ahead and look-behind have to be fixed-width patterns?"
- Reply: John Machin: "Re: Why do look-ahead and look-behind have to be fixed-width patterns?"
- Reply: Diez B. Roggisch: "Re: Why do look-ahead and look-behind have to be fixed-width patterns?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 27 Jan 2005 21:14:07 -0500
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 otherwise
but i just don't see how.
say i have the expression (?<=.*?:.*?:).*
all the engine has to do is search for .*?:.*?:.*, and then in each result,
find .*?:.*?: and return the string starting at the point just after the
length of the match.
no exponential time there, and even that is probably more inefficient than
it has to be.
- Next message: Jeremy Jones: "IPython Article on O'Reilly's ONLamp site"
- Previous message: Tom Willis: "win32com/makepy question"
- Next in thread: John Machin: "Re: Why do look-ahead and look-behind have to be fixed-width patterns?"
- Reply: John Machin: "Re: Why do look-ahead and look-behind have to be fixed-width patterns?"
- Reply: Diez B. Roggisch: "Re: Why do look-ahead and look-behind have to be fixed-width patterns?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|