Re: Everything between something becomes an array element
| From: | Andrey Hristov | Date: | Mon, 05 Nov 2001 20:37:44 +0000 |
| Subject: | Re: Everything between something becomes an array element | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73478@lists.php.net to get a copy of this message | ||
$how=preg_match_all('|\<tr>.(*?)</tr\>|',$the_big_string,$matches,PREG_SET_ORDER);
for ($counter=0;$counter<$how;$counter++){
$big_array[]=$matches[$counter][1]; //0 is the whole matched string, 1 is
// the first substring and so on
}
var_dump($big_array);
Regards,
Andrey Hristov
Web Developer
Icygen Corporation
BUILDING SOLUTIONS
http://www.icygen.com
On Monday 05 November 2001 08:32 am, you wrote:
> Hi All,
>
> I am playing with Regex this morning and could not find a solution. I
> have a string (fread from a page) where several times <tr>'s and </tr>'s
> appear.
>
> What I am trying to accomplish is to put everything between <tr> and
> </tr> in a 'place' where I can search for keywords later.
>
> I thought about making the middle content an array element but I don't
> understand much of Regex.
>
> Anyone can help me?
>
> Thanks a lot.
--