I am sure I have posted about this app before but it requires mentioning it again. I could not imagine writing regular expressions without using the Patterns app on the Mac. It allows you to test your regex in an editor and see a cheat sheet. When you are done, you can get export the regex code for your language. I highly recommend it!