Adding Code To Wordpress Blogs And Comments

Thursday, February 5, 2009 - 18:03

Wordpress is a pretty neat blogging platform, but it falls over quite spectacularly when trying to write code in posts. I write a lot of code for #! code and so I have understand what needs to be encoded to make code examples work.

For code example on #! code I use the <code> tag and I encode the following characters.

  • < into &lt;
  • > into &gt;
  • " into &quot;
  • ' into &#39;

Note: You must be in HTML mode in your Wordpress editor or everything will be double encoded.



Saturday, March 29, 2008 - 23:38

W3Schools is one of the best online tutorial sites available, but in addition to that, the site is completely free. When I can't remember how a particular bit of syntax goes I can be pretty much certain that I will find it on this site. There are thousands of examples, explanations, quizzes and reference charts available and they don't bog you down in too much detail. The examples on the site tell you exactly what you need to know about the subject so that you can copy the code and get on with the task at hand.


Common Regular Expressions

Monday, March 24, 2008 - 10:32

Here are some of the regular expressions that I frequently use.

Find a blank line



[ \t]+

You can use this to break a text string apart into words.



This will match anything in the format mm/dd/yyyy, or even dd/mm/yyyy.