[Bug] Regexp() and $ (was: Re: [Bug] Regexp.PCRE("n*") multiple match endless loop)

Bertrand LUPART bertrand.lupart at linkeo.com
Wed Apr 16 16:57:13 CEST 2008


Johan Sundström (Achtung Liebe!) @ Pike (-) developers forum
<10353 at lyskom.lysator.liu.se> wrote:

> > If you don't have a PCRE enabled Pike, then there should be a solution
> > with Regexp(). But it seems like there's a little bug with $ on
> > Regexp(), but one bug at a time :)
> 
> Not if it is the stone age Regexp(), as that one did/does not handle
> strings with null characters in it (except in cases where you really
> *want* it to treat \0 as end-of-string).

Interresting to know.

\0 could be replaced beforehand using replace(), then Regexp() used.
Even in this case, i guess we have a problem:

^ works:
----8<----8<----8<----8<----
> string bar = "oofoo";             
> Regexp("^[o]+")->replace(bar, "");
(1) Result: "foo"
---->8---->8---->8---->8----

While $ seems not:
----8<----8<----8<----8<----
> Regexp("[o]+$")->replace(bar, "");
(2) Result: "f"
---->8---->8---->8---->8----



-- 
Bertrand LUPART

http://bertrand.gotpike.org/




More information about the Pike-devel mailing list