Results 1 to 2 of 2

Thread: Pattern matching in string.

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2022
    Posts
    8

    Pattern matching in string.

    Hello All,
    I am trying to determine if a string as 3 alpha characters and 3 numerics to be valid.

    So if the strings looks like AKC047 then it would be considered valid...

    Jim

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,656

    Re: Pattern matching in string.

    Code:
    Imports System.Text.RegularExpressions
    Code:
    Dim s As String = "AKC047"
    Dim rx As New Regex("^[A-Z]{3}[0-9]{3}$")
    If rx.IsMatch(s) Then
       ' your code
    End If

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