Personal tools

Regular Expressions

Regular expressions can make your life a whole lot easier when it comes to validating form fields.





Domain
(([A-Za-z0-9_\\-]+\\.?)*)[A-Za-z0-9_\\-]+\\.[A-Za-z0-9_\\-]{2,6}
ZIP Code
(^\d{5}$)|(^\d{5}-\d{4}$)
Phone (US or International)
^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$
Credit Card Number
^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$
Currency
^\$?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$




Free link to your website when you post your code