Regex collection

This is a collection of regex expressions I often use. They are not perfect and 100% correct, but will catch most errors a user normally makes. Email addresses /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/ Phone number /^(\+|0{1,2}?)[1-9][\d -]+\/?[\d -]+$/ Matches: +49301234567 00 49 30 123 – 456 – 7 030 / 123 45 67 030/1-2-3-4-5-6-7 German postalcode / ZIP /^([0]{1}[1-9]{1}|[1-9]{1}[0-9]{1})[0-9]{3}$/ RegulΓ€rer Ausdruck fΓΌr Deutsche Postleitzahlen Date (dd.mm.YYYY) /^\d{2}\.\d{2}\.\d{4}$/

April 20, 2019 Β· 1 min Β· Anton Bracke