Salut,

Je suis de retour pour vous jouer un mauvais tour .

Bon je crois que les Regex m'aiment pas ....

Contexte : J'ai 4 Regex qui doivent récupérer des informations dans un fichier.
J'ai tout le code.
Ma Regex a est Ok.
Pour b c et d aucun résulat.
Je rentre pas dans les boucles.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 
For Each inventory In xmlDoc.selectNodes("/soapenv:Envelope/soapenv:Body/receiveInventory/inventoryReceipt")
 
					'** Code de la Matière **
					codeMatiereXML = inventory.selectSingleNode("ptPart").Text
 
					'** Quantité XML **
					quantiteXML = inventory.selectSingleNode("lotserialQty").Text
					qXML = Replace(quantiteXML,".",",")
 
					'** Zone **
					locationXML =  inventory.selectSingleNode("location").Text
					'MsgBox(locationXML)
 
					'** Numéro de lot **
					lotXML =  inventory.selectSingleNode("lotserial").Text
					'MsgBox(lotXML)
 
 
'--------------------------------------------------------------------------------------------------------------------------------
'RECHERCHE DANS FICHIER DE CONFIGURATION
 
					Set FileConfig = fso.OpenTextFile("P:\Detection Ajustement Stock\FichierConfiguration.txt",1,True)
					FileConfig_data = FileConfig.ReadAll
					FileConfig.Close 
					arrLines = Split(FileConfig_data,vbCrLf)
 
					Set a = New RegExp
					a.Pattern = "seuil_" & codeMatiereXML
					a.IgnoreCase = True 
					a.Global = False 'Renvoyer seulement la première occurrence
 
					Set b = New RegExp
					b.Pattern = "desc_" & codeMatiereXML
					b.IgnoreCase = True 
					b.Global = False 
 
					Set c = New RegExp
					c.Pattern = "qte_" & codeMatiereXML
					c.IgnoreCase = True 
					c.Global = False 'Renvoyer seulement la première occurrence
 
					Set d = New RegExp
					d.Pattern = "unit_" & codeMatiereXML
					d.IgnoreCase = True 
					d.Global = False 
 
 
					For Each strLine In arrLines
						'MsgBox(strLine)
						'Set occurrence = regEx.Execute(FileConfig_Data)
 
						occurrence = a.Test(strLine)
						recherche = b.Test(strLine)
						presence = c.Test(strLine)
						test = d.Test(strLine)
 
						'** Recherche Seuil d'alerte **
						If (occurrence = True) Then
							'MsgBox("OK")
							tab = Split(strLine,"=")
							seuilAjustement = tab(1)
							'MsgBox(seuilAjustement)
							qteXML = Csng(qXML)
							'MsgBox(qteXml)
							sAjust = Replace(seuilAjustement,".",",")
							'MsgBox(sAjust)
							seuilConf = Csng(sAjust)
 
							If (qteXML > seuilConf) Then
 
								'** Recherche Intitulé Matière **
								If (recherche = True) Then
									'MsgBox("OK")
									tab2 = Split(strLine,"=")
									descMatiere = tab2(1)
									MsgBox(descMatiere)
								End If
 
								If (presence = True) Then
									tab3 = Split(strLine,"=")
									quantiteStd = tab3(1)
									MsgBox(quantiteStd)
								End If
 
								If (test = True) Then
									'MsgBox("Ok")
									tab4 = Split(strLine,"=")
									unitMatiere = tab4(1)
									MsgBox(unitMatiere)
								End If
 
								Message = Message & Fichier_Line & "<br>"
 
							End If	
 
 
						End If
 
 
 
					Next
 
Next
Une idée ?

Miistik