Re: Re: If i use preg_match() how can i preg_match next?
| From: | Andrey Hristov | Date: | Thu, 30 Aug 2001 09:55:16 +0000 |
| Subject: | Re: Re: If i use preg_match() how can i preg_match next? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65194@lists.php.net to get a copy of this message | ||
It depends of the last parameter to preg_match_all.
PREG_PATTERN_ORDER and PREG_SET_ORDER.
One of these is the default value.
|<a (.*?)>(.*?)></a>|
PREG_PATTERN_ORDER :
----Orders results so that $matches[0] is an array of full pattern matches, $matches[1] is an array
of strings matched by the first
parenthesized subpattern, and so on. Using above pattern if we have some links in text to search for
matches then
$matches[1][0],$matches[1][1].... will contain the params of <a> .
$matches[2][0],$matches[2][1].... will contain the link text.
PREG_SET_ORDER :
----Orders results so that $matches[0] is an array of first set of matches, $matches[1] is an array
of second set of matches, and so
on. Using above pattern $matches[1][0] will be te params for fist matched link. $matches[1][1] link
text. $matches[2][0] params of
second matched <a>, $matches[2][1] link text ...and so on.
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
99%
----- Original Message -----
From: "_lallous" <elias_bachaalany@yahoo.com>
To: <php-general@lists.php.net>
Sent: Thursday, August 30, 2001 1:40 PM
Subject: [PHP] Re: If i use preg_match() how can i preg_match next?
> I don't really get it! in preg_match_all()
> the $matches array what will it contain?
>
> i mean $matches[0] is the whole match, and every $match[0][1] $match[0][2]
> $match[0][n] is my subexpression.
> now what does the $match[1] have? or $match[2] ?
>
> I usually use these modifiers: "/is"
>
> "Cc Zona" <cczona@nospam.invalid> wrote in message
> news:20010830085210.3727.qmail@pb1.pair.com...
> > In article <20010830083215.95556.qmail@pb1.pair.com>,
> > elias_bachaalany@yahoo.com (_lallous) wrote:
> >
> > > If i have this string: "1 2 3 4 5 6 7 no more!"
> > > and this regular expression: "([0-9]+)"
> > >
> > > now how can i run preg_match to get result by result until no results
> are
> > > returned?
> >
> > <http://php.net/preg_match_all>
> >
> > --
> > CC
>
>
>
> --
> 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
>
>