Solved

Validation

Posted on 2004-10-14
5
498 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

15 Experts available now in Live!

Get 1:1 Help Now