Yes the_lotus you're right but with matches
in my cases instead of match
.
I discovered it 30 minutes ago but I wanted to make it work before posting the solution.
Thanks to you I managed to assemble the peaces and this is the right code:
Dim lastFileNo As Integer = 1
Dim files() As String = Directory.GetFiles(frmMain.saveLocalTFPath, "*.docx")
For Each file As String In files
file = Path.GetFileNameWithoutExtension(file)
Dim numbers As MatchCollection = Regex.Matches(file, "(?<num>[\d]+)")
For Each number In numbers
number = CInt(number.ToString())
If number > 0 And number < 1000 And number > lastFileNo Then lastFileNo = number
Next
Next