RE: [PHP] Advanced RegExp
| From: | Mukul Sabharwal | Date: | Fri, 20 Oct 2000 15:18:56 +0000 |
| Subject: | RE: [PHP] Advanced RegExp | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21405@lists.php.net to get a copy of this message | ||
Ok.... so this can also be used to count occurences of
a string... right ?
ok... but why is 9 the limit....
--- Matthias Endler <endler@upsys.de> wrote: > Hi
Mukul,
> > I was wondering what
> >
> > \\1 ... \\2 meant in ereg...
> >
> > and how to occurenece in a string...
>
> I'll just give you an example and I think you'll
> understand.
>
> <?
> $test = "Mukul 123";
> $test = eregi_replace("^([a-z]+) ([0-9])$","Hello
> \\1 this is number
> \\2<br>\n", $test);
> // ^ \\1 ^ ^ \\2 ^
> print $test;
> ?>
>
> So \\1 contains the first part of the result which
> is surrounded by (), \\2
> the second and so on... you just count the opening
> paranthesis from left to
> right. There's one limitation though you have with
> ereg_*-functions you can
> only count till nine.
>
> Hope this helps.
>
> Cheers,
> Matthias
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
To Find Out More About Me : http://mukul.tsx.org/
__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/