RegEx un peu modifiée au début
(Code brouillon rapide)
Code : Tout sélectionner
EnableExplicit
Enumeration
#hFile
#RegEx
EndEnumeration
; --- Load datafile
If Not ReadFile(#hFile, "Datas.txt")
MessageRequester("Error", "No data file")
End
EndIf
Define Txt$
While Not Eof(#hFile)
Txt$ = ReadString(#hFile, #PB_File_IgnoreEOL)
Wend
CloseFile(#hFile)
; ---
Define RegEx$ = ~"<tr.+&\">(.+)</a></td>.+>(.*)</td>.+>(.*)</td>.+>(.*)</td>.+>(.*)</td>.+>(.*)</td>.+>(.*)</td>.+>(.*)</td>.+>(.*)</td>.+>(.*)</td>"
If Not CreateRegularExpression(#RegEx, RegEx$, #PB_RegularExpression_DotAll)
Debug "Regex HS"
Debug RegularExpressionError()
End
EndIf
Procedure Extract_Line(One_Line$, ID)
Protected i.a
If ExamineRegularExpression(#RegEx, One_Line$)
Define Nb_Cols = CountRegularExpressionGroups(#RegEx)
While NextRegularExpressionMatch(#RegEx)
For i = 1 To 10
Debug "" + RSet(Str(i), 2, " ") + ": " + RegularExpressionGroup(#RegEx, i)
Next
Wend
Debug "--- " + ID + " --------------------------------------------"
EndIf
EndProcedure
Define i
For i = 1 To CountString(Txt$, "<tbody>") + 1
Extract_Line(StringField(Txt$, i, "<tbody>"), i)
Next
End