title: Writing a syntax highlighter
body: <p>I was hoping to write my own syntax highlighter for a summer project I am thinking of working on but I am not sure how to write my own syntax highlighter.</p>
  
  <p>I know that there are bunch of implementations out there but I would like to learn about regular expressions and how syntax highlighting works.</p>
  
  <p>How does syntax highlighting work and what are some good references for developing one? Does the syntax highlighter scan each character as it is typed or does it scan the document/text area as a whole after each character is typed?</p>
  
  <p>Any insight would be greatly appreciated.</p>
  
  <p>Thanks.</p>
  
  <p>PS: I was planning on writing it in ActionScript</p>