Link to home
Start Free TrialLog in
Avatar of SirReadAlot
SirReadAlot

asked on

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
Avatar of Hans Langer
Hans Langer

 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

Avatar of SirReadAlot

ASKER

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}$"
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)

ASKER CERTIFIED SOLUTION
Avatar of Hans Langer
Hans Langer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks GL!!

THIS IS MORE THAN ENOUGH!!