[thelist] PHP and Regular expression Help.

Donald Noble donald at drnoble.co.uk
Mon Jul 1 13:55:01 CDT 2002

Hi evolters, I am trying to parse a plain text document to give a simple
html file. (on a windows machine)

the file has headings in BLOCK CAPITALS with 2 line breaks between

So far I have this...
	$fileContents =
	$fileContents = htmlentities($fileContents); // convert & to
&amp; etc.
	$fileContents = ereg_replace("^","<p>","$fileContents"); //start
with a <p>
	$fileContents = ereg_replace("$","</p>","$fileContents"); //end
with a </p>
	$fileContents =
ereg_replace("(\r\n){2}","</p>\r\n<p>","$fileContents"); // double line
break to </p><p>

The problem I have is how to convert the headings to have <h3></h3>
round them...

Cheers for your help :Donald

 Hardware, Software & Custom built PC Systems

More information about the thelist mailing list