Écriture impossible liée à un Regex
Bonjour le Forum,
Je sollicite votre précieuse aide.
Je cherche à vérifier les fichiers d'un dossier et écrire dans un .txt leur noms s'ils contiennent _3.9_. Pfiou tout ça.
J'ai essayé ce code qui malheureusement ne fonctionne pas.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| For Each Fichier In Folder.Files
If (FSO.GetExtensionName(Fichier.Path) = "txt") Then
Set OutPut = fso.OpenTextFile(Path_ListeXML,1)
Set objRegex = new RegExp
objRegex.Pattern = "(.w*)*\_3.9_(.w*)*\.txt"
objRegex.IgnoreCase = True
MsgBox(Fichier.Name)
'Set Matches = objRegex.Execute(Fichier.Name) 'Ok jusqu'ici
Set Matches = objRegex.Test(Fichier.Name)
'For Each Match in Matches 'OutPut.WriteLine (Fichier.Name)
'Next
'If (Matches.Count=1) Then
If (Matches=1) Then
Set OutPut = fso.OpenTextFile(Path_ListeXML,1)
OutPut.WriteLine (Fichier.Name)
End If
End If
Next |
Merci à vous,
Miistik