PHP ARRAY/REGEX PRO NEEDED!! HEEEEELP!

In short, I'm trying to re-create a Poker Stars hand history convertor I made a while back. I used to use ereg_replace on a multi-line variable of text, but there were little annoying problems that kept popping up. I decided to split the multi-line variable into an array so that each line was now its own variable, and I figure this will make the searching and replacing much more accurate.

This is eventually all going to be database driven, but for this example I've turned it into an array. If I can get help on this, I'll have no problem converting it over to the database version.

I'm basically trying to take a list of predefined REGEX rules (and their replacements), and then if these rules much the individual lines in the newly created array, replace them (so every rule should be checked against every line, and replaced if it matches).

I must be missing something here, possibly due to the fact that I've been sleep deprived for quite some time now :P (but no, not because of this convertor, hehe)

If any pros wanna help me out with this, it would be GREATLY appreciated.


<?php
// This is an include that I use within another file, and the "$new_hand" variable is already populated with a multi-line block of text

$rule[0] = "PokerStars Game \#([0-9]*): Tournament \#([0-9]*), Freeroll Hold'em No Limit - Level ([0-9a-zA-Z]*) \(([0-9]*)/([0-9]*)\) - ([0-9]*)/([0-9]*)/([0-9]*) - ([0-9]*):([0-9]*):([0-9]*) \(ET\)";

$rule_replacement[0] = "--------------------<BR><b>Hand Convertor v1.0 -- Poker Stars Tournament</b><BR><BR><b>NL Texas Hold'em, Freeroll - Level \\3</b> (\\4/\\5)<BR><BR><b>Tournament </b>#\\2, <b>Game </b>#\\1, ";

$rule[1] = "TESTER PokerStars Game \#([0-9]*): Tournament \#([0-9]*), Freeroll Hold'em No Limit - Level ([0-9a-zA-Z]*) \(([0-9]*)/([0-9]*)\) - ([0-9]*)/([0-9]*)/([0-9]*) - ([0-9]*):([0-9]*):([0-9]*) \(ET\)";

$rule_replacement[1] = "TESTER --------------------<BR><b> Hand Convertor v1.0 -- Poker Stars Tournament</b><BR><BR><b>NL Texas Hold'em, Freeroll - Level \\3</b> (\\4/\\5)<BR><BR><b>Tournament </b>#\\2, <b>Game </b>#\\1, ";

// Split the multi-line variable into an array so that each line is now its own variable
$hand_test = split("\n", $new_hand);

$rule_count = count($rule);

foreach($hand_test as $ht) {

$count = 0;

while ($count <= $rule_count) {
$skibble[$count] = eregi_replace($rule[$count], $rule_replacement[$count], $ht);
$count++;
}
}
?>

At this point I'd like the "$skibble" variable to contain the old "$new_hand" information, except with the replaced, formatted text.

I'm sure I'm going to be incredibly embarassed when I see what I've done wrong here.