Regular Expressions and Empty Strings

C

cleo

I'm experimenting with Regular Expressions and Windows Forms.
Frequently I want a value to be either a valid pattern or empty. For
example a Zip code must be 5 digits or may be empty. I know that I can use
the Regular Expression "\d{5}" to test for exactly 5 digits. How can I add
the option for the string to be empty or must I always test the value before
calling the Regular Expression?

Thanks
 
C

cleo

Thanks, this expression works. I wasn't aware of the $ expression. The
tutorial references are helpful since I haven't found much just browsing VB
Help.
 

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

Top