I need to find the folder name with special word. My code doesn't work. Would someone tell me how to solve it. I want the folder name with or without () would be fine. I am not sure how many digit in the blanket. There are example:
C:\test\REG33006\2017-03-09
C:\test\REG33006\2017-03-09(1)
C:\test\REG33006\2017-03-09(100)
There is my code in vb:
Dim Dir as string="C:\test\REG33006\2017-03-09(1)"
Dim patt As String ="^C:\\test\REG33006\\2017-03-09\(*\d*\)*$"
Dim regex As Regex = New Regex(patt)
Dim match As Match = regex.Match(Dir)
If match.Success Then
If Dir.Contains(")") Then
Dim indexStart As Integer = Dir.IndexOf("(")
maxNumber = CInt(Dir.Substring(indexStart + 1, Dir.Length - indexStart))
End If
End If