CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Oct 2006
    Posts
    28

    Regex code not working

    Hi,

    I have written a short piece of code to validate a UK NI number.

    The format is 2 upper case letters, followed by 6 digits followed by A,B, C or D

    eg AB123456A is OK

    This code does not work, it never matches even when the string NI_Num is OK:


    Dim NIr As Regex
    Dim match As Boolean

    NIr = New Regex("^[A-Z]^2[0-9]^6[A,B,C,D]")

    match = NIr.IsMatch(NI_Num(count))


    match is always false. Any suggestions where I'm going wrong?

    Tia

    H
    Last edited by happyme; April 2nd, 2009 at 08:52 AM.
    I'm using .NET Framework 3.5

    I'm planning to be spontaneous tomorrow

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured