Jan Schreuder on .Net

.Net code samples, experiences, observations

View my professional profile on LinkedIn

Recent Posts

Tags

News

  • Inappropriate comments will be deleted at my discretion.

    The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.

Community

Email Notifications

Tool suppliers

Tools

General

Microsoft

Favorite blogs

Archives

Regular expressions library

For the project I work on now, I needed to know if the string contained a valid dutch postcode value. Best way to do this is using a regular expression. For example:

int IsPostcode(string value)
{
   Regex regex =
new Regex(@"^[1-9][0-9]{3}\s?[a-zA-Z]{2}$");
  
Match m = regex.Match(value);
  
return m.Success;
}

The problem is of course finding the right expressions. For this, I now use Regular Expression Library on the internet. Most of you probably already know this web site. For those who don't, check it out. It's a really good resource for regular expression.

Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 6 and 4 and type the answer here: