Previously, Ker Ruben Ramos said:
> hmm, got a little question.
> 1. what's that \\1 and \\2? got any info on where u got that from?
Expands to whatever the parentheses surrounded during the match. So
in this case you have:
Match pattern: "<a href=\"([^/]+)/(.*)\\.html\">"
Replace pattern: "<a href=\"file.php?file=\\1\\2.php\">"
There are two places in the match pattern where there are (). These are
memorized (rather whatever they actually matched was memorized) and then
you can spit it back out in the replacement pattern using \\1, \\2, etc.
-dan
> 2. what if it's just href="anything.html" ? i mean.. something like it got
> lots of subdirectories or not.
>
> Thanks
> ----- Original Message -----
> From: "Mark Maggelet" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 24, 2001 1:19 AM
> Subject: Re: [PHP] ereg questions
>
>
> > On Thu, 24 May 2001 01:01:16 +0800, Ker Ruben Ramos
> > ([EMAIL PROTECTED]) wrote:
> > >How do i change all '<a href="anything/here.html">' to '<a
> > >href="file.php?file=anythinghere.php">'
> > >any help out there?
> >
> > I would go:
> >
> > $string = ereg_replace(
> > "<a href=\"([^/]+)/(.*)\\.html\">",
> > "<a href=\"file.php?file=\\1\\2.php\">",
> > $string);
> >
> > - Mark
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
If carpenters made buildings the way programmers make programs, the first
woodpecker to come along would destroy all of civilization.
-Weinberg's Second Law
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]