Zip In Masked Text Box

Zip In Masked Text Box

Comments

  • How do I format a masked text box to allow a zip plus 4 but the plus 4 may not always be there.

  • [font=Roboto, Arial, Helvetica, sans-serif]So lets assume that the formats were specifically looking for is "12345" OR "12345-6789." So the hyphen must be included. First, set your Masked Text Box to custom. (documentation) Then for your custom mask you will enter ^d{5}(?:[-]d{4})?$ Heres an explanation of this expression. ^ = Start of the string. d{5} = Match 5 digits (first zip code format) (?:…) = Grouping [-] = Match a hyphen (indicates the second zip code format)* d{4} = Match 4 digits (the second part of the second format) …? = The pattern before it is optional (for the first format) $ = End of the string.[/font]

Sign In or Register to comment.