On Friday 16 August 2002 22:12, lallous wrote:
> Actually the interpreter will evaluate the '\1'. '1' . '\2' into one string
> before passing it to preg_replace
> So it will yield up as I originally wrote it, and it won't work.
Hmm, you're right. The interpreter is smarter than I thought :-/
--
James,
Actually the interpreter will evaluate the '\1'. '1' . '\2' into one string
before passing it to preg_replace
So it will yield up as I originally wrote it, and it won't work.
Elias
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Friday
On Friday 16 August 2002 19:49, lallous wrote:
> $fn = 'test.gif';
>
> echo preg_replace('/(.+?)(\..+?)/', '\1a\2', $fn);
>
> ?>
>
> This script will output 'testa.gif'
>
> now how can i make it produce 'test1.gif' ?
>
> if i replace the: '\1a\2' with '\11\2' it will understand to replace with
>
This script will output 'testa.gif'
now how can i make it produce 'test1.gif' ?
if i replace the: '\1a\2' with '\11\2' it will understand to replace with
occurence number 11 !
How can i escape the 2nd '1' so it is considered as a string an not another
number.
Elias
--
PHP General Mailing
4 matches
Mail list logo