* "Mark Cain" <mark@xxxxxxxxxxxx> : > Here is one way to do it: > > $rr="thisscritjajsj[ OUT1 ]ajdamsda;sjo;tkpdk[ OUT2 ]sdfmjs[ OUT3 ]dfjlsd"; > > preg_match("/.*\[(.*)\].*\[(.*)\].*\[(.*)\].*/", $rr, $match); > > list($whole_match[],$a[],$a[],$a[]) = $match; This is fine as long as there's precisely three escape sequences in the string; if there's an arbitrary number, that won't work. I've posted another solution already using preg_match_all() that will. > ----- Original Message ----- > From: <pineriver@xxxxxxxxx> > To: <php-general@xxxxxxxxxxxxx> > Sent: Tuesday, June 14, 2005 8:13 PM > Subject: split()? > > > > How would I do this ? > > > > Take this string and return everything between [ ] as an array > > output doesnt have to inlude [ ] > > $rr="thisscritjajsj[ OUT1 ]ajdamsda;sjo;tkpdk[ OUT2 ]sdfmjs[ > > OUT3 ]dfjlsd"; > > > > $a = some function > > > > echo '<pre> '; > > print_r($a); > > > > [0] => [ OUT1 ] > > [1] => [ OUT2 ] > > [2] => [ OUT3 ] -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:matthew@xxxxxxxxxx | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php