Re: Re: If i use preg_match() how can i preg_match next?
| From: | _lallous | Date: | Thu, 30 Aug 2001 13:26:07 +0000 |
| Subject: | Re: Re: If i use preg_match() how can i preg_match next? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65263@lists.php.net to get a copy of this message | ||
Thanks alot Andrey.
"Andrey Hristov" <ahristov@icygen.com> wrote in message
news:017a01c13139$e1bb2600$0b01a8c0@ANDreY...
> 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
> >
> >
>