title: Regex for only hours or hours and minutes
body: <p>I am using regex <code>^(([0-9])|([0-1][0-9])|([2][0-3])):(([0-9])|([0-5][0-9]))$</code> for time. It is very good regex but when user wants to enter only hours like 8 or 12 without colon and minutes it is not allowing. 
  Can any one suggests which regular expressions suits hours only or hours:minutes.</p>