<!DOCTYPE html> <html lang="en"> <head> <meta charset=utf-8 /> <title>pattern</title> </head> <body> <form> <input required
pattern="[0-9]{5}(\-[0-9]{4})?|[a-zA-Z]{1,2}\d{1,2}\s?\d[a-zA-Z]{1,2}"
name=part title="A zip code or postcode in the format of 99999 or 99999-9999" > <input type=submit> </form> </body> </html>