Regular Expressions and Empty Strings

  • Thread starter Thread starter cleo
  • Start date Start date
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
 
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.
 
Back
Top