From: "John Nichel" <[EMAIL PROTECTED]>
>>On Thursday 05 August 2004 07:39, Jay offered up the following tid-bit of
>>information :
>> Found the following code in the PHP manual:
>> $text = "http://www.somelink.com";;
>> echo(ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",
>>                      "<a href=\"\\0\">\\0</a>", $text));
>>
>> What does \\0 means, i have seen this before with \\1 and \\2
>
> Well, I'm not much of a ereg guy...more preg, but if I had to take a
guess,
> the \\0 in ereg is like $1 in perl regular expressions.  ie it's replacing
> the \\0 with the first match found in the expression.  Run the
script...I'm
> betting it will out put...
>
> <a href="http://www.somelink.com";>http://www.somelink.com</a>
>
> Course, if I'm wrong, someone on the list will be quick to lay the smack
> down on me, and you'll get the correct answer. ;)

oo.ooo... can I do it?? ;)

\\0 is actually the entire string that was matches. \\1 would be the first
parenthesized substring, \\2 the second, etc.

Don't worry, I had to look in the manual to be sure, too. :)

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to