Here's what I'm trying to parse:
<DIV style='width:420' id=0 class=jt>
<SPAN class=T1675751k0>
OCEANFRONT APT
</SPAN>
<SPAN class=T1675751b>
Green Diamond Unit 2103. Beautifully upgraded 3/3. Jacuzzi bathroom, marble floors. Asking $4,500 unfurnished. Call Tony Cho 305-693-3422.
<BR>
</SPAN>
</DIV>
I've added newlines to make the string breaks more clear. The actual strings being parsed are more like:
<DIV style='width:420' id=0 class=jt> <SPAN class=T1675751k0>
OCEANFRONT APT </SPAN><SPAN class=T1675751b>Green Diamond Unit 2103. Beautifully upgraded 3/3. Jacuzzi bathroom, marble floors. Asking $4,500 unfurnished. Call Tony Cho 305-693-3422.<BR></SPAN></DIV><DIV style='width:420' class=j><SPAN class=T1675751b> </SPAN></SPAN></DIV>
There has got be a simple way to do this, but I'm at my wit's end.
What I'd like, ideally, is an array that looks something like:
c<DIV style='width:420' id=0 class=jt>';
$array[0]='<SPAN class=T1675751k0>';
$array[1]='OCEANFRONT APT ';
$array[2]='</SPAN>';
$array[3]='<SPAN class=T1675751b>';
$array[4]='Green Diamond Unit 2103. Beautifully upgraded 3/3. Jacuzzi bathroom, marble floors. Asking $4,500 unfurnished. Call Tony Cho 305-693-3422.';
$array[5]='<BR>';
$array[6]='</SPAN>';
$array[7]='</DIV>';
My current method of grinding through the string character by character is a disaster. There must be a better way.
I have gotten some traction using explode. But so far every method I try ends up getting too complex to maintain.
I'm really bad with regexps.
Also, please help me by noting whether I should be using ereg or preg_match_all or whatever. I can't figure out the difference between these functions either.