title: Syntax highlighting text read from file using CSS from regular expressions
body: <p>I am attempting to read a file on my server and then use regular expressions to determine what formatting each part of that text file should have when viewed within a web-browser. I am simply opening <em>file.txt</em>'s contents and reading.</p>
  
  <p>P.S. - I have no problem with creating and using CSS classes and would prefer to use them if possible from an external stylesheet.</p>
  
  <p>I'm purely stuck on how to add the formatting to each individual part of the text file based on the rules from the regular expressions - does anyone have any suggestions for the PHP coding?</p>
  
  <p><strong>Primarily:</strong><br>
  1.How to apply the regular expressions to each individual part of the whole text<br>
  2.How to apply the css rules in an external stylesheet <em>(class1, class2, etc.)</em> given by class name to above <em>(see 1)</em> specific part of the text</p>
  
  <p><strong>For example:</strong>
  <em>(see sample of text file below if more clarity is required on the format / size of this)</em></p>
  
  <p>Forcing any date such as <code>14.11.2013 - 23.51.40</code> to be formatted in an italic green font by using the following regular expression:</p>
  
  <p><code>[0-9]+[.][0-9]+[.][0-9]+ - [0-9]+[.][0-9]+[.][0-9]+</code>.</p>
  
  <p>Then have upper-case words such as <code>DELETE</code> formatted differently in a bold red font from lower-case etc.</p>
  
  <p><strong>Sample of text:</strong></p>
  
  <p><em>This .txt file is around 1 Mb in size at the moment - however this changes each time the script that creates it is run.</em></p>
  
  <pre><code>14.11.2013 - 23.51.40 - START BACKUP LOG
  14.11.2013 - 23.51.40 - INITIATE BACKUP PROCEDURE
  14.11.2013 - 23.51.40 - DELETE previous backup log
  </code></pre>