Solved

Validation

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

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.…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

820 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