Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Regular Expression Tips and Tricks   (RSS)

Pattern Matching

At some point everyone has written code to test values that match patterns. There are many different ways this can be done. Typical examples, include string handling or using the myriad of other algorithms available. Recently, I have been working the

Validating Zip Code

I was recently putting together some proof of concept for a customer and realized that I hadn't posted one of the common Regular Expressions that I had been using. Validating a Zip Code: Private Sub Button1_Click( ByVal sender As System.Object, ByVal

Finding a Value

Character matching is one of the most powerful features of regular expressions. They allow the developer to quickly find certain patterns and characters within strings. The “.” is one of the most important and easiest to use examples of this. The period

Validating a Phone Number

Simple example of validating a phone number: Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Invalid phone number 'Dim strPhone As String = "123456789" ' valid phone number Dim strPhone As

Validating Email

While doing some coding the other day I needed an expression to validate email addresses. The trick was that it had to be flexible enough to handle emails in the format of username@company.com and firstname.lastname@company.com . Imports System.Text.RegularExpressions

What is a Regular Expression

Regular expressions are about finding and changing patterns. One of the most common that I always find is the need to reformat a “proper name”. It seems that every conversion program that I get involved in requires the re-ordering of the name. Regular
 
Page view tracker