RE: [Phplib-users] Patch to page.inc
Brought to you by:
nhruby,
richardarcher
|
From: Marko K. <M.K...@os...> - 2002-11-04 08:42:54
|
On Thu, 31 Oct 2002, Rob Hutton wrote:
> OK, I'm not a regex guy, so the goals are to strip the
> $this->urlaction, the =value that follows, anf the preceeding & if it
> is there
that's what is done by
<?php
$a='url?test=testen&&test2=test2en&';
echo "Rewrote:".ereg_replace("([?&])test=[^&]*&*", "\\1",$a)."\n";
?>
>(it may be the first parameter and therefor is preceded by a
> ? which should be left unless it is the only parameter).
could be done with
<?php
$a='url?&';
echo "\nNew: ".ereg_replace("^([^&?]*)[?&]+$", "\\1",$a)."\n";
?>
which removes all &s and ?s from the end of the string!
Marko
|