<?php $str = '#@data1#@data2#@data3#@'; $count = preg_match_all('/\#\@([\w\d]+?)(?=\#\@)/',$str,$results); var_dump($results);
?> Produces : array(2) { [0]=> array(3) { [0]=> string(7) "#@data1" [1]=> string(7) "#@data2" [2]=> string(7) "#@data3" } [1]=> array(3) { [0]=> string(5) "data1" [1]=> string(5) "data2" [2]=> string(5) "data3" } } Best regards, Andrey Hristov IcyGEN Corporation http://www.icygen.com BALANCED SOLUTIONS ----- Original Message ----- From: "Joeri Vankelst" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 27, 2001 11:27 AM Subject: [PHP] Extracting data > Hi, > > I'm looking for a way to extract data from a single variable. > I'll explain: > > The variable contains somthing that look like: #@data1#@data2#@data3 > What I would like to do is check the data between the #@'s so I can compare > data1, 2 and 3 with a another variable. The next this I would like to be > able to do is count the #@'s so I can seen how many items there are in the > variable. > > Any help would be greatly appreciated! > > Joeri Vankelst > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]