help with regular expression

J

John Livermore

I am not sure if this is the correct newsgroup, so if this post
belongs somewhere else, I would appreciate the pointer.

Here's my question:

I have the following regular expression I use to match against user
entered US zip codes. However, no entry is valid as well (the zip
code can be blank). Can I specify that with one regular expression?

Here is the one I am using to validate zip codes:

\d{5}(-\d{4})?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top