On 16-Sep-2003 Susan Ator wrote: > I have a text file with the following format: > > <TO> name > <SUBJECT> stuff > <MESSAGE> > message text > message text > message text >
<snip> If you're sure the format is exactly that, then ... $pat=array( '<SUBJECT>', '<MESSAGE>', ); $marker='<FOO>'; $data=file_get_contents('dafile.txt'); $msgblks=explode('<TO>', $data); foreach($msgblks as $blk) { list($to, $subj, $msg) = explode($marker,preg_replace($pat, $marker, $blk)); ... do__your_stuff($to, $subj, $msg); ... } Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php