Handy regex / preg_match for ZIP codes, phone numbers, states, SSN, URLs, and email addresses

Here is a handy collection of regular expressions, for use with PHP preg_match. If you need to check for properly formatted US states (two letters), US ZIP codes, US phone numbers, US Social Security Numbers, URLs for web sites, and properly formatted email addresses, read on: Continue reading

Clear DNS cache on Mac OS X

Changing domains around on your web server can leave you with a local DNS cache that doesn’t match your domain’s new settings. Flush your DNS cache on Mac OS X 10.5 by issuing the following command:

Edit 5/19/2014: OS X Mavericks has a slightly different method for clearing the DNS cache.