I'm trying to parse a very complex dictionary file... Here's a sample of the data (this is one of the very simple lines):
<key>uel2.06:xanax<cw>Xanax<ent><me>Xan&syl;ax</me><pron>(zan&prim;aks),</pron><pdef><lab>Pharm. Trademark.</lab></pdef><def cat='PHA,TRM'>a brand of alprazolam.</def></ent></cw></key>
I'm trying to develop a regular expression that will capture the starting key, the data in the middle, then the ending key.
So far, I've got this:
$reNode = "(<[>]>)";
$reData = "(.)";
$reEndNode = "(</[>]*>)";
$reCheck = $reNode.$reData.$reEndNode;
This works fine the first couple of times through this loop:
do
{
ereg($reCheck, $data, $test);
echo $test[1]."\n";
echo $test[2]."\n";
echo $test[3]."\n\n";
$data = $test[2];
} while ($test[1] != "" AND $test[2] != "" AND $test[3] != "")
It doesn't break u ntill it get's to the tag <me>. Then it skips over the end tag </me> and grabs the end tag </pron>.
Any help would be very appreciated.