I have a very long text file, and it has to be input into a page. Here is the deal:
Many of the lines contain the symbol '#' in the middle. There is always something before or after the symbol, it's a pattern. Many of the lines do not contain the '#' symbol.
I have added a <br> before every line, now I want to add an extra <br> before all lines that do NOT contain the '#' symbol. Here is my script:
<?php
$file = 'C:\docs\longtext.txt';
$file = file("$file");
if (!$file)
{print "Failed!"; die;}
else
{$content = join("", $file);}
------------------------------
$result = ereg_replace ("(.*)#$", "<br><br>\1\2", $content);
print "$result";
?>
This is obviously not working, but I don't know why.
Regular expressions can be tricky indeed...
Luciano ES
Santos, SP - Brasil