<input type="text" pattern="([0-9]{5}(-[0-9]{4})?)|([A-Z][0-9][A-Z]\s+[0-9][A-Z][0-9])">
Quelle: http://www.alistapart.com/articles/get-ready-for-html-5/