• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

Validation

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
SirReadAlot
Asked:
SirReadAlot
  • 3
  • 2
1 Solution
 
Hans LangerCommented:
 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
 
SirReadAlotAuthor Commented:
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
 
SirReadAlotAuthor Commented:
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
 
Hans LangerCommented:
Try
http://www.regexlib.com/Search.aspx 
And search for the keyword "UK"
GL
0
 
SirReadAlotAuthor Commented:
thanks GL!!

THIS IS MORE THAN ENOUGH!!
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now