RE: [PHP] EREG_REPLACE different from 4.04 to 4.06
| From: | Christoph Starkmann | Date: | Mon, 05 Nov 2001 14:46:37 +0000 |
| Subject: | RE: [PHP] EREG_REPLACE different from 4.04 to 4.06 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-73487@lists.php.net to get a copy of this message | ||
Well...
> >From: Christoph Starkmann <kiko@nfq.de>
> > > ereg_replace(".*?site=", "", $path);
> >
> >Depends on what you want to find, but as far as I see
> >your expression doesn't make too much sense when you
> >DON'T excape the "?".
> >
> >In the above case, it would search for
> >
> >.* any number (0 to ...) of characters
> >? one or none character
> >site=
>
> Yes, I think you are right. So why doesn't it match something like
> /aaaaaa?site=x in 4.06? I thought regexp should find the
> longest match which
> would include would be /aaaaaa?site=
> Just a comment :)
I see... I think now YOU are right.
.*?site should match any string that contains site= because
.* can be any (or no) char and
? can be zero or any (one) char.
And YES, IMHO
/aaaaa?site=x
should be matched.
Anybody knows what's going on here?
Cheers,
Kiko
-----
It's not a bug, it's a feature.
christoph starkmann
mailto:kiko@nfq.de
http://www.fh-augsburg.de/~kiko
ICQ: 100601600
-----