Click here to Skip to main content
15,895,011 members

Response to: How to sub string in string in vb.net

Revision 2
Is this what you are looking for?

Imports System.Text.RegularExpressions
Module Module1

  Sub Main
    Dim txt As String ="00AA015949" ' Put value you want to test here!

    Dim re1 As String="(\d+)"	'Integer Number 1
    Dim re2 As String="((?:[a-z][a-z]+))"	'Word 1
    Dim re3 As String="(\d+)"	'Integer Number 2

    Dim r As Regex = new Regex(re1+re2+re3,RegexOptions.IgnoreCase Or _ 
                     RegexOptions.Singleline)
    Dim m As Match = r.Match(txt)
    If (m.Success) Then
        Dim int1=m.Groups(1)
        Dim word1=m.Groups(2)
        Dim int2=m.Groups(3)
        Console.WriteLine("(" & int1.ToString() & _
            ")" & "(" & word1.ToString() & ")" & _
            "(" & int2.ToString() & ")")
    End If
    Console.ReadLine()
  End Sub
End Module


I generated this at: txt2re - regular expression generator[^]
Posted 29-Jan-13 2:41am by Mike Meinz.
Tags: