Solved

Validation

Posted on 2004-10-14
5
497 Views
Last Modified: 2008-02-26
How do you validate the following:

UK National Insurance number( e.g pw 25 45 45 B)
UK PHONE NUMBER (eg 0000 000 0000)


thanks
0
Comment
Question by:SirReadAlot
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:Hans Langer
ID: 12307916
 Imports System.Text.RegularExpressions


    Private Function IsValidUKNI(ByVal RegExString As String) As Boolean
        Dim pattern As String = "^[A-Z]{2}[0-9]{6}[A-DFM]{1}$"
        Dim expression As Regex = New Regex(pattern)
        Return expression.IsMatch(RegExString )
    End Function

    Private Function IsValidUKPN(ByVal RegExString As String) As Boolean
        Dim pattern As String = "(\s*\(?0\d{4}\)?\s*\d{6}\s*)|(\s*\(?0\d{3}\)?\s*\d{3}\s*\d{4}\s*)"
        Dim expression As Regex = New Regex(pattern)
        Return expression.IsMatch(RegExString )
    End Function

0
 

Author Comment

by:SirReadAlot
ID: 12308841
Basically i want to past them into the validation expression.

so far non works UK Nation Insurance Number (aa 11 11 66 h)
"^[A-Z]{2}[0-9]{6}[A-DFM]{1}$"
0
 

Author Comment

by:SirReadAlot
ID: 12308946
Basically i want to paste them into the validation expression.

so far non works.

 UK Nation Insurance Number (aa 11 11 66 h)
"^[A-Z]{2}[0-9]{6}[A-DFM]{1}$"



UK PHONE NUMBER (eg 0000 000 0000)

0
 
LVL 10

Accepted Solution

by:
Hans Langer earned 25 total points
ID: 12308961
Try
http://www.regexlib.com/Search.aspx
And search for the keyword "UK"
GL
0
 

Author Comment

by:SirReadAlot
ID: 12309169
thanks GL!!

THIS IS MORE THAN ENOUGH!!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now