hi, i want to explode noaa weather reports at each line like
so the i can make the text format better for my site but i can't figure out my regx.
my code is below. the idea is that in each section but the third, \n are replaced with <BR>\n.
any help would be appreciated.
oh, i've also got the source online at http://uac.pdx.edu/source.php?file=/test-avalanche.php.
thanks!
$file = fopen("http://www.seawfo.noaa.gov/products/SABNW", "r");
$rf = fread($file, 20000);
fclose($file);
$sections = split("[*]{0,}$", $rf);
if (eregi("SUMMER AVALANCHE STATEMENT", $rf)){
echo '<TR><TD align="right"><B><FONT color="#990000" size="-1">Please note the Avalanche Forecast is a seasonal report.</FONT></B></TD></TR>';
}
str_replace ("\n", "<BR>\n", $sections[0]);
str_replace ("\n", "<BR>\n", $sections[2]);
str_replace ("\n\n", "\n<P>", $sections[4]);
str_replace ("\n", "<BR>\n", $sections[6]);
foreach ($sections as $piece) {
echo '<TR><TD bgcolor="white">';
echo $piece;
echo ' </TD></TR>';
}