It is ugly, but I finally found a way that works:
$content = ereg_replace("(\n)([1-9])([0-9])([0-9])([0-9])([0-9])([0-9])|", "NewLineHere\2\3\4\5\6\7|", $content);
$content = ereg_replace("(\n)", "", $content);
$content = ereg_replace("(NewLineHere)", "\n", $content);
The delimiter is a pipe, and thankfully all the 6 digits I have to save were followed by the delimeter. So I ended up searching for those, "Saving" them using the NewLineHere text, nuking the new lines in the rest of the file, and then putting the correct new lines back.
I hope this helps anyone who runs into a similar problem. 😃
Regards,
Max