/^(\d{6} #leading digits (?:\.? #if dot, then (?:(?:\d{2})? #if two digits, then \w?)))$/x; #maybe a character